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

vfs: Make d_invalidate return void

Now that d_invalidate can no longer fail, stop returning a useless
return code. For the few callers that checked the return code update
remove the handling of d_invalidate failure.

Reviewed-by: Miklos Szeredi <miklos@szeredi.hu>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

authored by

Eric W. Biederman and committed by
Al Viro
5542aa2f 1ffe46d1

+13 -32
+1 -4
fs/btrfs/ioctl.c
··· 2423 2423 goto out_dput; 2424 2424 } 2425 2425 2426 - err = d_invalidate(dentry); 2427 - if (err) 2428 - goto out_unlock; 2426 + d_invalidate(dentry); 2429 2427 2430 2428 down_write(&root->fs_info->subvol_sem); 2431 2429 ··· 2508 2510 btrfs_subvolume_release_metadata(root, &block_rsv, qgroup_reserved); 2509 2511 out_up_write: 2510 2512 up_write(&root->fs_info->subvol_sem); 2511 - out_unlock: 2512 2513 if (err) { 2513 2514 spin_lock(&dest->root_item_lock); 2514 2515 root_flags = btrfs_root_flags(&dest->root_item);
+1 -5
fs/cifs/readdir.c
··· 87 87 return; 88 88 89 89 if (dentry) { 90 - int err; 91 - 92 90 inode = dentry->d_inode; 93 91 if (inode) { 94 92 /* ··· 103 105 goto out; 104 106 } 105 107 } 106 - err = d_invalidate(dentry); 108 + d_invalidate(dentry); 107 109 dput(dentry); 108 - if (err) 109 - return; 110 110 } 111 111 112 112 /*
+3 -12
fs/dcache.c
··· 1346 1346 * d_invalidate - detach submounts, prune dcache, and drop 1347 1347 * @dentry: dentry to invalidate (aka detach, prune and drop) 1348 1348 * 1349 - * Try to invalidate the dentry if it turns out to be 1350 - * possible. If there are reasons not to delete it 1351 - * return -EBUSY. On success return 0. 1352 - * 1353 1349 * no dcache lock. 1354 1350 * 1355 1351 * The final d_drop is done as an atomic operation relative to 1356 1352 * rename_lock ensuring there are no races with d_set_mounted. This 1357 1353 * ensures there are no unhashed dentries on the path to a mountpoint. 1358 1354 */ 1359 - int d_invalidate(struct dentry *dentry) 1355 + void d_invalidate(struct dentry *dentry) 1360 1356 { 1361 - int ret = 0; 1362 - 1363 1357 /* 1364 1358 * If it's already been dropped, return OK. 1365 1359 */ 1366 1360 spin_lock(&dentry->d_lock); 1367 1361 if (d_unhashed(dentry)) { 1368 1362 spin_unlock(&dentry->d_lock); 1369 - return 0; 1363 + return; 1370 1364 } 1371 1365 spin_unlock(&dentry->d_lock); 1372 1366 1373 1367 /* Negative dentries can be dropped without further checks */ 1374 1368 if (!dentry->d_inode) { 1375 1369 d_drop(dentry); 1376 - goto out; 1370 + return; 1377 1371 } 1378 1372 1379 1373 for (;;) { ··· 1393 1399 1394 1400 cond_resched(); 1395 1401 } 1396 - 1397 - out: 1398 - return ret; 1399 1402 } 1400 1403 EXPORT_SYMBOL(d_invalidate); 1401 1404
+1 -3
fs/fuse/dir.c
··· 1286 1286 d_drop(dentry); 1287 1287 } else if (get_node_id(inode) != o->nodeid || 1288 1288 ((o->attr.mode ^ inode->i_mode) & S_IFMT)) { 1289 - err = d_invalidate(dentry); 1290 - if (err) 1291 - goto out; 1289 + d_invalidate(dentry); 1292 1290 } else if (is_bad_inode(inode)) { 1293 1291 err = -EIO; 1294 1292 goto out;
+5 -5
fs/namei.c
··· 1306 1306 if (error < 0) { 1307 1307 dput(dentry); 1308 1308 return ERR_PTR(error); 1309 - } else if (!d_invalidate(dentry)) { 1309 + } else { 1310 + d_invalidate(dentry); 1310 1311 dput(dentry); 1311 1312 dentry = NULL; 1312 1313 } ··· 1436 1435 dput(dentry); 1437 1436 return status; 1438 1437 } 1439 - if (!d_invalidate(dentry)) { 1440 - dput(dentry); 1441 - goto need_lookup; 1442 - } 1438 + d_invalidate(dentry); 1439 + dput(dentry); 1440 + goto need_lookup; 1443 1441 } 1444 1442 1445 1443 path->mnt = mnt;
+1 -2
fs/nfs/dir.c
··· 486 486 nfs_setsecurity(dentry->d_inode, entry->fattr, entry->label); 487 487 goto out; 488 488 } else { 489 - if (d_invalidate(dentry) != 0) 490 - goto out; 489 + d_invalidate(dentry); 491 490 dput(dentry); 492 491 } 493 492 }
+1 -1
include/linux/dcache.h
··· 254 254 extern void shrink_dcache_sb(struct super_block *); 255 255 extern void shrink_dcache_parent(struct dentry *); 256 256 extern void shrink_dcache_for_umount(struct super_block *); 257 - extern int d_invalidate(struct dentry *); 257 + extern void d_invalidate(struct dentry *); 258 258 259 259 /* only used at mount-time */ 260 260 extern struct dentry * d_make_root(struct inode *);