Skip to content

Commit 5542aa2

Browse files
ebiedermAl Viro
authored andcommitted
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>
1 parent 1ffe46d commit 5542aa2

7 files changed

Lines changed: 13 additions & 32 deletions

File tree

‎fs/btrfs/ioctl.c‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2423,9 +2423,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
24232423
goto out_dput;
24242424
}
24252425

2426-
err = d_invalidate(dentry);
2427-
if (err)
2428-
goto out_unlock;
2426+
d_invalidate(dentry);
24292427

24302428
down_write(&root->fs_info->subvol_sem);
24312429

@@ -2510,7 +2508,6 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
25102508
btrfs_subvolume_release_metadata(root, &block_rsv, qgroup_reserved);
25112509
out_up_write:
25122510
up_write(&root->fs_info->subvol_sem);
2513-
out_unlock:
25142511
if (err) {
25152512
spin_lock(&dest->root_item_lock);
25162513
root_flags = btrfs_root_flags(&dest->root_item);

‎fs/cifs/readdir.c‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ cifs_prime_dcache(struct dentry *parent, struct qstr *name,
8787
return;
8888

8989
if (dentry) {
90-
int err;
91-
9290
inode = dentry->d_inode;
9391
if (inode) {
9492
/*
@@ -105,10 +103,8 @@ cifs_prime_dcache(struct dentry *parent, struct qstr *name,
105103
goto out;
106104
}
107105
}
108-
err = d_invalidate(dentry);
106+
d_invalidate(dentry);
109107
dput(dentry);
110-
if (err)
111-
return;
112108
}
113109

114110
/*

‎fs/dcache.c‎

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1346,34 +1346,28 @@ static void check_and_drop(void *_data)
13461346
* d_invalidate - detach submounts, prune dcache, and drop
13471347
* @dentry: dentry to invalidate (aka detach, prune and drop)
13481348
*
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-
*
13531349
* no dcache lock.
13541350
*
13551351
* The final d_drop is done as an atomic operation relative to
13561352
* rename_lock ensuring there are no races with d_set_mounted. This
13571353
* ensures there are no unhashed dentries on the path to a mountpoint.
13581354
*/
1359-
int d_invalidate(struct dentry *dentry)
1355+
void d_invalidate(struct dentry *dentry)
13601356
{
1361-
int ret = 0;
1362-
13631357
/*
13641358
* If it's already been dropped, return OK.
13651359
*/
13661360
spin_lock(&dentry->d_lock);
13671361
if (d_unhashed(dentry)) {
13681362
spin_unlock(&dentry->d_lock);
1369-
return 0;
1363+
return;
13701364
}
13711365
spin_unlock(&dentry->d_lock);
13721366

13731367
/* Negative dentries can be dropped without further checks */
13741368
if (!dentry->d_inode) {
13751369
d_drop(dentry);
1376-
goto out;
1370+
return;
13771371
}
13781372

13791373
for (;;) {
@@ -1399,9 +1393,6 @@ int d_invalidate(struct dentry *dentry)
13991393

14001394
cond_resched();
14011395
}
1402-
1403-
out:
1404-
return ret;
14051396
}
14061397
EXPORT_SYMBOL(d_invalidate);
14071398

‎fs/fuse/dir.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1286,9 +1286,7 @@ static int fuse_direntplus_link(struct file *file,
12861286
d_drop(dentry);
12871287
} else if (get_node_id(inode) != o->nodeid ||
12881288
((o->attr.mode ^ inode->i_mode) & S_IFMT)) {
1289-
err = d_invalidate(dentry);
1290-
if (err)
1291-
goto out;
1289+
d_invalidate(dentry);
12921290
} else if (is_bad_inode(inode)) {
12931291
err = -EIO;
12941292
goto out;

‎fs/namei.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,7 +1306,8 @@ static struct dentry *lookup_dcache(struct qstr *name, struct dentry *dir,
13061306
if (error < 0) {
13071307
dput(dentry);
13081308
return ERR_PTR(error);
1309-
} else if (!d_invalidate(dentry)) {
1309+
} else {
1310+
d_invalidate(dentry);
13101311
dput(dentry);
13111312
dentry = NULL;
13121313
}
@@ -1435,10 +1436,9 @@ static int lookup_fast(struct nameidata *nd,
14351436
dput(dentry);
14361437
return status;
14371438
}
1438-
if (!d_invalidate(dentry)) {
1439-
dput(dentry);
1440-
goto need_lookup;
1441-
}
1439+
d_invalidate(dentry);
1440+
dput(dentry);
1441+
goto need_lookup;
14421442
}
14431443

14441444
path->mnt = mnt;

‎fs/nfs/dir.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,8 +486,7 @@ void nfs_prime_dcache(struct dentry *parent, struct nfs_entry *entry)
486486
nfs_setsecurity(dentry->d_inode, entry->fattr, entry->label);
487487
goto out;
488488
} else {
489-
if (d_invalidate(dentry) != 0)
490-
goto out;
489+
d_invalidate(dentry);
491490
dput(dentry);
492491
}
493492
}

‎include/linux/dcache.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ extern struct dentry * d_obtain_root(struct inode *);
254254
extern void shrink_dcache_sb(struct super_block *);
255255
extern void shrink_dcache_parent(struct dentry *);
256256
extern void shrink_dcache_for_umount(struct super_block *);
257-
extern int d_invalidate(struct dentry *);
257+
extern void d_invalidate(struct dentry *);
258258

259259
/* only used at mount-time */
260260
extern struct dentry * d_make_root(struct inode *);

0 commit comments

Comments
 (0)