diff options
-rw-r--r-- | fs/btrfs/ioctl.c | 5 | ||||
-rw-r--r-- | fs/cifs/readdir.c | 6 | ||||
-rw-r--r-- | fs/dcache.c | 15 | ||||
-rw-r--r-- | fs/fuse/dir.c | 4 | ||||
-rw-r--r-- | fs/namei.c | 10 | ||||
-rw-r--r-- | fs/nfs/dir.c | 3 | ||||
-rw-r--r-- | include/linux/dcache.h | 2 |
7 files changed, 13 insertions, 32 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 8a8e29878c34..996eb192fa77 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -2423,9 +2423,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file, | |||
2423 | goto out_dput; | 2423 | goto out_dput; |
2424 | } | 2424 | } |
2425 | 2425 | ||
2426 | err = d_invalidate(dentry); | 2426 | d_invalidate(dentry); |
2427 | if (err) | ||
2428 | goto out_unlock; | ||
2429 | 2427 | ||
2430 | down_write(&root->fs_info->subvol_sem); | 2428 | down_write(&root->fs_info->subvol_sem); |
2431 | 2429 | ||
@@ -2510,7 +2508,6 @@ out_release: | |||
2510 | btrfs_subvolume_release_metadata(root, &block_rsv, qgroup_reserved); | 2508 | btrfs_subvolume_release_metadata(root, &block_rsv, qgroup_reserved); |
2511 | out_up_write: | 2509 | out_up_write: |
2512 | up_write(&root->fs_info->subvol_sem); | 2510 | up_write(&root->fs_info->subvol_sem); |
2513 | out_unlock: | ||
2514 | if (err) { | 2511 | if (err) { |
2515 | spin_lock(&dest->root_item_lock); | 2512 | spin_lock(&dest->root_item_lock); |
2516 | root_flags = btrfs_root_flags(&dest->root_item); | 2513 | root_flags = btrfs_root_flags(&dest->root_item); |
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c index b334a89d6a66..d2141f101382 100644 --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c | |||
@@ -87,8 +87,6 @@ cifs_prime_dcache(struct dentry *parent, struct qstr *name, | |||
87 | return; | 87 | return; |
88 | 88 | ||
89 | if (dentry) { | 89 | if (dentry) { |
90 | int err; | ||
91 | |||
92 | inode = dentry->d_inode; | 90 | inode = dentry->d_inode; |
93 | if (inode) { | 91 | if (inode) { |
94 | /* | 92 | /* |
@@ -105,10 +103,8 @@ cifs_prime_dcache(struct dentry *parent, struct qstr *name, | |||
105 | goto out; | 103 | goto out; |
106 | } | 104 | } |
107 | } | 105 | } |
108 | err = d_invalidate(dentry); | 106 | d_invalidate(dentry); |
109 | dput(dentry); | 107 | dput(dentry); |
110 | if (err) | ||
111 | return; | ||
112 | } | 108 | } |
113 | 109 | ||
114 | /* | 110 | /* |
diff --git a/fs/dcache.c b/fs/dcache.c index 5e02b9eee6b1..70d102e70271 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -1346,34 +1346,28 @@ static void check_and_drop(void *_data) | |||
1346 | * d_invalidate - detach submounts, prune dcache, and drop | 1346 | * d_invalidate - detach submounts, prune dcache, and drop |
1347 | * @dentry: dentry to invalidate (aka detach, prune and drop) | 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 | * no dcache lock. | 1349 | * no dcache lock. |
1354 | * | 1350 | * |
1355 | * The final d_drop is done as an atomic operation relative to | 1351 | * The final d_drop is done as an atomic operation relative to |
1356 | * rename_lock ensuring there are no races with d_set_mounted. This | 1352 | * rename_lock ensuring there are no races with d_set_mounted. This |
1357 | * ensures there are no unhashed dentries on the path to a mountpoint. | 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 | * If it's already been dropped, return OK. | 1358 | * If it's already been dropped, return OK. |
1365 | */ | 1359 | */ |
1366 | spin_lock(&dentry->d_lock); | 1360 | spin_lock(&dentry->d_lock); |
1367 | if (d_unhashed(dentry)) { | 1361 | if (d_unhashed(dentry)) { |
1368 | spin_unlock(&dentry->d_lock); | 1362 | spin_unlock(&dentry->d_lock); |
1369 | return 0; | 1363 | return; |
1370 | } | 1364 | } |
1371 | spin_unlock(&dentry->d_lock); | 1365 | spin_unlock(&dentry->d_lock); |
1372 | 1366 | ||
1373 | /* Negative dentries can be dropped without further checks */ | 1367 | /* Negative dentries can be dropped without further checks */ |
1374 | if (!dentry->d_inode) { | 1368 | if (!dentry->d_inode) { |
1375 | d_drop(dentry); | 1369 | d_drop(dentry); |
1376 | goto out; | 1370 | return; |
1377 | } | 1371 | } |
1378 | 1372 | ||
1379 | for (;;) { | 1373 | for (;;) { |
@@ -1399,9 +1393,6 @@ int d_invalidate(struct dentry *dentry) | |||
1399 | 1393 | ||
1400 | cond_resched(); | 1394 | cond_resched(); |
1401 | } | 1395 | } |
1402 | |||
1403 | out: | ||
1404 | return ret; | ||
1405 | } | 1396 | } |
1406 | EXPORT_SYMBOL(d_invalidate); | 1397 | EXPORT_SYMBOL(d_invalidate); |
1407 | 1398 | ||
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index 820efd74ca9f..dbab798f5caf 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c | |||
@@ -1286,9 +1286,7 @@ static int fuse_direntplus_link(struct file *file, | |||
1286 | d_drop(dentry); | 1286 | d_drop(dentry); |
1287 | } else if (get_node_id(inode) != o->nodeid || | 1287 | } else if (get_node_id(inode) != o->nodeid || |
1288 | ((o->attr.mode ^ inode->i_mode) & S_IFMT)) { | 1288 | ((o->attr.mode ^ inode->i_mode) & S_IFMT)) { |
1289 | err = d_invalidate(dentry); | 1289 | d_invalidate(dentry); |
1290 | if (err) | ||
1291 | goto out; | ||
1292 | } else if (is_bad_inode(inode)) { | 1290 | } else if (is_bad_inode(inode)) { |
1293 | err = -EIO; | 1291 | err = -EIO; |
1294 | goto out; | 1292 | goto out; |
diff --git a/fs/namei.c b/fs/namei.c index 2ba10904dba0..d20d579a022e 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -1306,7 +1306,8 @@ static struct dentry *lookup_dcache(struct qstr *name, struct dentry *dir, | |||
1306 | if (error < 0) { | 1306 | if (error < 0) { |
1307 | dput(dentry); | 1307 | dput(dentry); |
1308 | return ERR_PTR(error); | 1308 | return ERR_PTR(error); |
1309 | } else if (!d_invalidate(dentry)) { | 1309 | } else { |
1310 | d_invalidate(dentry); | ||
1310 | dput(dentry); | 1311 | dput(dentry); |
1311 | dentry = NULL; | 1312 | dentry = NULL; |
1312 | } | 1313 | } |
@@ -1435,10 +1436,9 @@ unlazy: | |||
1435 | dput(dentry); | 1436 | dput(dentry); |
1436 | return status; | 1437 | return status; |
1437 | } | 1438 | } |
1438 | if (!d_invalidate(dentry)) { | 1439 | d_invalidate(dentry); |
1439 | dput(dentry); | 1440 | dput(dentry); |
1440 | goto need_lookup; | 1441 | goto need_lookup; |
1441 | } | ||
1442 | } | 1442 | } |
1443 | 1443 | ||
1444 | path->mnt = mnt; | 1444 | path->mnt = mnt; |
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 8be6988a1c6c..06e8cfcbb670 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -486,8 +486,7 @@ void nfs_prime_dcache(struct dentry *parent, struct nfs_entry *entry) | |||
486 | nfs_setsecurity(dentry->d_inode, entry->fattr, entry->label); | 486 | nfs_setsecurity(dentry->d_inode, entry->fattr, entry->label); |
487 | goto out; | 487 | goto out; |
488 | } else { | 488 | } else { |
489 | if (d_invalidate(dentry) != 0) | 489 | d_invalidate(dentry); |
490 | goto out; | ||
491 | dput(dentry); | 490 | dput(dentry); |
492 | } | 491 | } |
493 | } | 492 | } |
diff --git a/include/linux/dcache.h b/include/linux/dcache.h index 595af29ad145..81b03150f39a 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h | |||
@@ -254,7 +254,7 @@ extern struct dentry * d_obtain_root(struct inode *); | |||
254 | extern void shrink_dcache_sb(struct super_block *); | 254 | extern void shrink_dcache_sb(struct super_block *); |
255 | extern void shrink_dcache_parent(struct dentry *); | 255 | extern void shrink_dcache_parent(struct dentry *); |
256 | extern void shrink_dcache_for_umount(struct super_block *); | 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 | /* only used at mount-time */ | 259 | /* only used at mount-time */ |
260 | extern struct dentry * d_make_root(struct inode *); | 260 | extern struct dentry * d_make_root(struct inode *); |