mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	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 <ericvh@kernel.org> Reviewed-by: Dominique Martinet <asmadeus@codewreck.org>
This commit is contained in:
		
							parent
							
								
									3866584a1c
								
							
						
					
					
						commit
						89c58cb395
					
				
					 1 changed files with 4 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -197,7 +197,7 @@ static int v9fs_dir_readdir_dotl(struct file *file, struct dir_context *ctx)
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * v9fs_dir_release - close a directory
 | 
			
		||||
 * v9fs_dir_release - called on a close of a file or directory
 | 
			
		||||
 * @inode: inode of the directory
 | 
			
		||||
 * @filp: file pointer to a directory
 | 
			
		||||
 *
 | 
			
		||||
| 
						 | 
				
			
			@ -209,6 +209,7 @@ int v9fs_dir_release(struct inode *inode, struct file *filp)
 | 
			
		|||
	struct p9_fid *fid;
 | 
			
		||||
	__le32 version;
 | 
			
		||||
	loff_t i_size;
 | 
			
		||||
	int retval = 0;
 | 
			
		||||
 | 
			
		||||
	fid = filp->private_data;
 | 
			
		||||
	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)
 | 
			
		|||
		spin_lock(&inode->i_lock);
 | 
			
		||||
		hlist_del(&fid->ilist);
 | 
			
		||||
		spin_unlock(&inode->i_lock);
 | 
			
		||||
		p9_fid_put(fid);
 | 
			
		||||
		retval = p9_fid_put(fid);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if ((filp->f_mode & FMODE_WRITE)) {
 | 
			
		||||
| 
						 | 
				
			
			@ -228,7 +229,7 @@ int v9fs_dir_release(struct inode *inode, struct file *filp)
 | 
			
		|||
	} else {
 | 
			
		||||
		fscache_unuse_cookie(v9fs_inode_cookie(v9inode), NULL, NULL);
 | 
			
		||||
	}
 | 
			
		||||
	return 0;
 | 
			
		||||
	return retval;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const struct file_operations v9fs_dir_operations = {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue