Skip to content

Commit 89c58cb

Browse files
committed
fs/9p: fix error reporting in v9fs_dir_release
Checking the p9_fid_put value allows us to pass back errors involved if we end up clunking the fid as part of dir_release. This can help with more graceful response to errors in writeback among other things. Signed-off-by: Eric Van Hensbergen <[email protected]> Reviewed-by: Dominique Martinet <[email protected]>
1 parent 3866584 commit 89c58cb

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

fs/9p/vfs_dir.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ static int v9fs_dir_readdir_dotl(struct file *file, struct dir_context *ctx)
197197

198198

199199
/**
200-
* v9fs_dir_release - close a directory
200+
* v9fs_dir_release - called on a close of a file or directory
201201
* @inode: inode of the directory
202202
* @filp: file pointer to a directory
203203
*
@@ -209,6 +209,7 @@ int v9fs_dir_release(struct inode *inode, struct file *filp)
209209
struct p9_fid *fid;
210210
__le32 version;
211211
loff_t i_size;
212+
int retval = 0;
212213

213214
fid = filp->private_data;
214215
p9_debug(P9_DEBUG_VFS, "inode: %p filp: %p fid: %d\n",
@@ -217,7 +218,7 @@ int v9fs_dir_release(struct inode *inode, struct file *filp)
217218
spin_lock(&inode->i_lock);
218219
hlist_del(&fid->ilist);
219220
spin_unlock(&inode->i_lock);
220-
p9_fid_put(fid);
221+
retval = p9_fid_put(fid);
221222
}
222223

223224
if ((filp->f_mode & FMODE_WRITE)) {
@@ -228,7 +229,7 @@ int v9fs_dir_release(struct inode *inode, struct file *filp)
228229
} else {
229230
fscache_unuse_cookie(v9fs_inode_cookie(v9inode), NULL, NULL);
230231
}
231-
return 0;
232+
return retval;
232233
}
233234

234235
const struct file_operations v9fs_dir_operations = {

0 commit comments

Comments
 (0)