diff options
Diffstat (limited to 'fs/nfs/dir.c')
-rw-r--r-- | fs/nfs/dir.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index aaf7bd0cbae2..d8015a03db4c 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -424,12 +424,17 @@ static int xdr_decode(nfs_readdir_descriptor_t *desc, | |||
424 | static | 424 | static |
425 | int nfs_same_file(struct dentry *dentry, struct nfs_entry *entry) | 425 | int nfs_same_file(struct dentry *dentry, struct nfs_entry *entry) |
426 | { | 426 | { |
427 | struct inode *inode; | ||
427 | struct nfs_inode *nfsi; | 428 | struct nfs_inode *nfsi; |
428 | 429 | ||
429 | if (d_really_is_negative(dentry)) | 430 | if (d_really_is_negative(dentry)) |
430 | return 0; | 431 | return 0; |
431 | 432 | ||
432 | nfsi = NFS_I(d_inode(dentry)); | 433 | inode = d_inode(dentry); |
434 | if (is_bad_inode(inode) || NFS_STALE(inode)) | ||
435 | return 0; | ||
436 | |||
437 | nfsi = NFS_I(inode); | ||
433 | if (entry->fattr->fileid == nfsi->fileid) | 438 | if (entry->fattr->fileid == nfsi->fileid) |
434 | return 1; | 439 | return 1; |
435 | if (nfs_compare_fh(entry->fh, &nfsi->fh) == 0) | 440 | if (nfs_compare_fh(entry->fh, &nfsi->fh) == 0) |
@@ -1363,7 +1368,6 @@ EXPORT_SYMBOL_GPL(nfs_dentry_operations); | |||
1363 | struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, unsigned int flags) | 1368 | struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, unsigned int flags) |
1364 | { | 1369 | { |
1365 | struct dentry *res; | 1370 | struct dentry *res; |
1366 | struct dentry *parent; | ||
1367 | struct inode *inode = NULL; | 1371 | struct inode *inode = NULL; |
1368 | struct nfs_fh *fhandle = NULL; | 1372 | struct nfs_fh *fhandle = NULL; |
1369 | struct nfs_fattr *fattr = NULL; | 1373 | struct nfs_fattr *fattr = NULL; |
@@ -1393,7 +1397,6 @@ struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, unsigned in | |||
1393 | if (IS_ERR(label)) | 1397 | if (IS_ERR(label)) |
1394 | goto out; | 1398 | goto out; |
1395 | 1399 | ||
1396 | parent = dentry->d_parent; | ||
1397 | /* Protect against concurrent sillydeletes */ | 1400 | /* Protect against concurrent sillydeletes */ |
1398 | trace_nfs_lookup_enter(dir, dentry, flags); | 1401 | trace_nfs_lookup_enter(dir, dentry, flags); |
1399 | error = NFS_PROTO(dir)->lookup(dir, &dentry->d_name, fhandle, fattr, label); | 1402 | error = NFS_PROTO(dir)->lookup(dir, &dentry->d_name, fhandle, fattr, label); |
@@ -1536,9 +1539,9 @@ int nfs_atomic_open(struct inode *dir, struct dentry *dentry, | |||
1536 | err = PTR_ERR(inode); | 1539 | err = PTR_ERR(inode); |
1537 | trace_nfs_atomic_open_exit(dir, ctx, open_flags, err); | 1540 | trace_nfs_atomic_open_exit(dir, ctx, open_flags, err); |
1538 | put_nfs_open_context(ctx); | 1541 | put_nfs_open_context(ctx); |
1542 | d_drop(dentry); | ||
1539 | switch (err) { | 1543 | switch (err) { |
1540 | case -ENOENT: | 1544 | case -ENOENT: |
1541 | d_drop(dentry); | ||
1542 | d_add(dentry, NULL); | 1545 | d_add(dentry, NULL); |
1543 | nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); | 1546 | nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); |
1544 | break; | 1547 | break; |