Commit d8da097a authored by Latchesar Ionkov's avatar Latchesar Ionkov Committed by Linus Torvalds

[PATCH] v9fs: fix fid management in v9fs_create

v9fs_create doesn't manage correctly the fids when it is called to create a
directory..  The fid created by the create 9P call (newfid) and the one
created by walking to already created file (wfidno) are not used
consistently.

This patch cleans up the usage of newfid and wfidno.
Signed-off-by: default avatarLatchesar Ionkov <lucho@ionkov.net>
Cc: Eric Van Hensbergen <ericvh@ericvh.myip.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 3cf6429a
...@@ -385,13 +385,14 @@ v9fs_create(struct inode *dir, ...@@ -385,13 +385,14 @@ v9fs_create(struct inode *dir,
fid->iounit = iounit; fid->iounit = iounit;
} else { } else {
err = v9fs_t_clunk(v9ses, newfid); err = v9fs_t_clunk(v9ses, newfid);
newfid = -1;
if (err < 0) if (err < 0)
dprintk(DEBUG_ERROR, "clunk for mkdir failed: %d\n", err); dprintk(DEBUG_ERROR, "clunk for mkdir failed: %d\n", err);
} }
/* walk to the newly created file and put the fid in the dentry */ /* walk to the newly created file and put the fid in the dentry */
wfidno = v9fs_get_idpool(&v9ses->fidpool); wfidno = v9fs_get_idpool(&v9ses->fidpool);
if (newfid < 0) { if (wfidno < 0) {
eprintk(KERN_WARNING, "no free fids available\n"); eprintk(KERN_WARNING, "no free fids available\n");
return -ENOSPC; return -ENOSPC;
} }
...@@ -408,7 +409,6 @@ v9fs_create(struct inode *dir, ...@@ -408,7 +409,6 @@ v9fs_create(struct inode *dir,
fcall = NULL; fcall = NULL;
if (!v9fs_fid_create(file_dentry, v9ses, wfidno, 0)) { if (!v9fs_fid_create(file_dentry, v9ses, wfidno, 0)) {
v9fs_t_clunk(v9ses, newfid);
v9fs_put_idpool(wfidno, &v9ses->fidpool); v9fs_put_idpool(wfidno, &v9ses->fidpool);
goto CleanUpFid; goto CleanUpFid;
...@@ -419,7 +419,7 @@ v9fs_create(struct inode *dir, ...@@ -419,7 +419,7 @@ v9fs_create(struct inode *dir,
(perm & V9FS_DMDEVICE)) (perm & V9FS_DMDEVICE))
return 0; return 0;
result = v9fs_t_stat(v9ses, newfid, &fcall); result = v9fs_t_stat(v9ses, wfidno, &fcall);
if (result < 0) { if (result < 0) {
dprintk(DEBUG_ERROR, "stat error: %s(%d)\n", FCALL_ERROR(fcall), dprintk(DEBUG_ERROR, "stat error: %s(%d)\n", FCALL_ERROR(fcall),
result); result);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment