Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fs/9p: Don't clunk dentry fid when we fail to get a writeback inode

The dentry fid get clunked via the dput.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>

authored by

Aneesh Kumar K.V and committed by
Eric Van Hensbergen
398c4f0e 08bb3a50

+6 -5
+6 -5
fs/9p/vfs_inode_dotl.c
··· 259 259 if (IS_ERR(inode_fid)) { 260 260 err = PTR_ERR(inode_fid); 261 261 mutex_unlock(&v9inode->v_mutex); 262 - goto error; 262 + goto err_clunk_old_fid; 263 263 } 264 264 v9inode->writeback_fid = (void *) inode_fid; 265 265 } ··· 267 267 /* Since we are opening a file, assign the open fid to the file */ 268 268 filp = lookup_instantiate_filp(nd, dentry, generic_file_open); 269 269 if (IS_ERR(filp)) { 270 - p9_client_clunk(ofid); 271 - return PTR_ERR(filp); 270 + err = PTR_ERR(filp); 271 + goto err_clunk_old_fid; 272 272 } 273 273 filp->private_data = ofid; 274 274 #ifdef CONFIG_9P_FSCACHE ··· 278 278 return 0; 279 279 280 280 error: 281 - if (ofid) 282 - p9_client_clunk(ofid); 283 281 if (fid) 284 282 p9_client_clunk(fid); 283 + err_clunk_old_fid: 284 + if (ofid) 285 + p9_client_clunk(ofid); 285 286 return err; 286 287 } 287 288