diff mbox

[V9fs-developer,2/3] 9p: clunk fid on failed remove

Message ID 1269002848-13913-2-git-send-email-aneesh.kumar@linux.vnet.ibm.com (mailing list archive)
State Accepted
Delegated to: Eric Van Hensbergen
Headers show

Commit Message

Aneesh Kumar K.V March 19, 2010, 12:47 p.m. UTC
None
diff mbox

Patch

diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 5fe45d6..ae83967 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -431,6 +431,7 @@  error:
 
 static int v9fs_remove(struct inode *dir, struct dentry *file, int rmdir)
 {
+	int retval;
 	struct inode *file_inode;
 	struct v9fs_session_info *v9ses;
 	struct p9_fid *v9fid;
@@ -444,7 +445,10 @@  static int v9fs_remove(struct inode *dir, struct dentry *file, int rmdir)
 	if (IS_ERR(v9fid))
 		return PTR_ERR(v9fid);
 
-	return p9_client_remove(v9fid);
+	retval = p9_client_remove(v9fid);
+	if (!retval)
+		drop_nlink(file_inode);
+	return retval;
 }
 
 static int
diff --git a/net/9p/client.c b/net/9p/client.c
index e3e5bf4..460cf79 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -1124,8 +1124,11 @@  int p9_client_remove(struct p9_fid *fid)
 
 	p9_free_req(clnt, req);
 	p9_fid_destroy(fid);
+	return err;
 
 error:
+	/* if we failed remove clunk the fid */
+	p9_client_clunk(fid);
 	return err;
 }
 EXPORT_SYMBOL(p9_client_remove);