Commit 5542aa2f authored by Eric W. Biederman's avatar Eric W. Biederman Committed by Al Viro

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: default avatarMiklos Szeredi <miklos@szeredi.hu>
Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 1ffe46d1
...@@ -2423,9 +2423,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file, ...@@ -2423,9 +2423,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
goto out_dput; goto out_dput;
} }
err = d_invalidate(dentry); d_invalidate(dentry);
if (err)
goto out_unlock;
down_write(&root->fs_info->subvol_sem); down_write(&root->fs_info->subvol_sem);
...@@ -2510,7 +2508,6 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file, ...@@ -2510,7 +2508,6 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
btrfs_subvolume_release_metadata(root, &block_rsv, qgroup_reserved); btrfs_subvolume_release_metadata(root, &block_rsv, qgroup_reserved);
out_up_write: out_up_write:
up_write(&root->fs_info->subvol_sem); up_write(&root->fs_info->subvol_sem);
out_unlock:
if (err) { if (err) {
spin_lock(&dest->root_item_lock); spin_lock(&dest->root_item_lock);
root_flags = btrfs_root_flags(&dest->root_item); root_flags = btrfs_root_flags(&dest->root_item);
......
...@@ -87,8 +87,6 @@ cifs_prime_dcache(struct dentry *parent, struct qstr *name, ...@@ -87,8 +87,6 @@ cifs_prime_dcache(struct dentry *parent, struct qstr *name,
return; return;
if (dentry) { if (dentry) {
int err;
inode = dentry->d_inode; inode = dentry->d_inode;
if (inode) { if (inode) {
/* /*
...@@ -105,10 +103,8 @@ cifs_prime_dcache(struct dentry *parent, struct qstr *name, ...@@ -105,10 +103,8 @@ cifs_prime_dcache(struct dentry *parent, struct qstr *name,
goto out; goto out;
} }
} }
err = d_invalidate(dentry); d_invalidate(dentry);
dput(dentry); dput(dentry);
if (err)
return;
} }
/* /*
......
...@@ -1346,34 +1346,28 @@ static void check_and_drop(void *_data) ...@@ -1346,34 +1346,28 @@ static void check_and_drop(void *_data)
* d_invalidate - detach submounts, prune dcache, and drop * d_invalidate - detach submounts, prune dcache, and drop
* @dentry: dentry to invalidate (aka detach, prune and drop) * @dentry: dentry to invalidate (aka detach, prune and drop)
* *
* Try to invalidate the dentry if it turns out to be
* possible. If there are reasons not to delete it
* return -EBUSY. On success return 0.
*
* no dcache lock. * no dcache lock.
* *
* The final d_drop is done as an atomic operation relative to * The final d_drop is done as an atomic operation relative to
* rename_lock ensuring there are no races with d_set_mounted. This * rename_lock ensuring there are no races with d_set_mounted. This
* ensures there are no unhashed dentries on the path to a mountpoint. * ensures there are no unhashed dentries on the path to a mountpoint.
*/ */
int d_invalidate(struct dentry *dentry) void d_invalidate(struct dentry *dentry)
{ {
int ret = 0;
/* /*
* If it's already been dropped, return OK. * If it's already been dropped, return OK.
*/ */
spin_lock(&dentry->d_lock); spin_lock(&dentry->d_lock);
if (d_unhashed(dentry)) { if (d_unhashed(dentry)) {
spin_unlock(&dentry->d_lock); spin_unlock(&dentry->d_lock);
return 0; return;
} }
spin_unlock(&dentry->d_lock); spin_unlock(&dentry->d_lock);
/* Negative dentries can be dropped without further checks */ /* Negative dentries can be dropped without further checks */
if (!dentry->d_inode) { if (!dentry->d_inode) {
d_drop(dentry); d_drop(dentry);
goto out; return;
} }
for (;;) { for (;;) {
...@@ -1399,9 +1393,6 @@ int d_invalidate(struct dentry *dentry) ...@@ -1399,9 +1393,6 @@ int d_invalidate(struct dentry *dentry)
cond_resched(); cond_resched();
} }
out:
return ret;
} }
EXPORT_SYMBOL(d_invalidate); EXPORT_SYMBOL(d_invalidate);
......
...@@ -1286,9 +1286,7 @@ static int fuse_direntplus_link(struct file *file, ...@@ -1286,9 +1286,7 @@ static int fuse_direntplus_link(struct file *file,
d_drop(dentry); d_drop(dentry);
} else if (get_node_id(inode) != o->nodeid || } else if (get_node_id(inode) != o->nodeid ||
((o->attr.mode ^ inode->i_mode) & S_IFMT)) { ((o->attr.mode ^ inode->i_mode) & S_IFMT)) {
err = d_invalidate(dentry); d_invalidate(dentry);
if (err)
goto out;
} else if (is_bad_inode(inode)) { } else if (is_bad_inode(inode)) {
err = -EIO; err = -EIO;
goto out; goto out;
......
...@@ -1306,7 +1306,8 @@ static struct dentry *lookup_dcache(struct qstr *name, struct dentry *dir, ...@@ -1306,7 +1306,8 @@ static struct dentry *lookup_dcache(struct qstr *name, struct dentry *dir,
if (error < 0) { if (error < 0) {
dput(dentry); dput(dentry);
return ERR_PTR(error); return ERR_PTR(error);
} else if (!d_invalidate(dentry)) { } else {
d_invalidate(dentry);
dput(dentry); dput(dentry);
dentry = NULL; dentry = NULL;
} }
...@@ -1435,10 +1436,9 @@ static int lookup_fast(struct nameidata *nd, ...@@ -1435,10 +1436,9 @@ static int lookup_fast(struct nameidata *nd,
dput(dentry); dput(dentry);
return status; return status;
} }
if (!d_invalidate(dentry)) { d_invalidate(dentry);
dput(dentry); dput(dentry);
goto need_lookup; goto need_lookup;
}
} }
path->mnt = mnt; path->mnt = mnt;
......
...@@ -486,8 +486,7 @@ void nfs_prime_dcache(struct dentry *parent, struct nfs_entry *entry) ...@@ -486,8 +486,7 @@ void nfs_prime_dcache(struct dentry *parent, struct nfs_entry *entry)
nfs_setsecurity(dentry->d_inode, entry->fattr, entry->label); nfs_setsecurity(dentry->d_inode, entry->fattr, entry->label);
goto out; goto out;
} else { } else {
if (d_invalidate(dentry) != 0) d_invalidate(dentry);
goto out;
dput(dentry); dput(dentry);
} }
} }
......
...@@ -254,7 +254,7 @@ extern struct dentry * d_obtain_root(struct inode *); ...@@ -254,7 +254,7 @@ extern struct dentry * d_obtain_root(struct inode *);
extern void shrink_dcache_sb(struct super_block *); extern void shrink_dcache_sb(struct super_block *);
extern void shrink_dcache_parent(struct dentry *); extern void shrink_dcache_parent(struct dentry *);
extern void shrink_dcache_for_umount(struct super_block *); extern void shrink_dcache_for_umount(struct super_block *);
extern int d_invalidate(struct dentry *); extern void d_invalidate(struct dentry *);
/* only used at mount-time */ /* only used at mount-time */
extern struct dentry * d_make_root(struct inode *); extern struct dentry * d_make_root(struct inode *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment