diff options
| -rw-r--r-- | fs/nfs/dir.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 7dc88bb4296c..0090dae1acd3 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
| @@ -1529,9 +1529,7 @@ EXPORT_SYMBOL_GPL(nfs_atomic_open); | |||
| 1529 | 1529 | ||
| 1530 | static int nfs4_lookup_revalidate(struct dentry *dentry, unsigned int flags) | 1530 | static int nfs4_lookup_revalidate(struct dentry *dentry, unsigned int flags) |
| 1531 | { | 1531 | { |
| 1532 | struct dentry *parent = NULL; | ||
| 1533 | struct inode *inode; | 1532 | struct inode *inode; |
| 1534 | struct inode *dir; | ||
| 1535 | int ret = 0; | 1533 | int ret = 0; |
| 1536 | 1534 | ||
| 1537 | if (flags & LOOKUP_RCU) | 1535 | if (flags & LOOKUP_RCU) |
| @@ -1545,34 +1543,35 @@ static int nfs4_lookup_revalidate(struct dentry *dentry, unsigned int flags) | |||
| 1545 | goto no_open; | 1543 | goto no_open; |
| 1546 | 1544 | ||
| 1547 | inode = dentry->d_inode; | 1545 | inode = dentry->d_inode; |
| 1548 | parent = dget_parent(dentry); | ||
| 1549 | dir = parent->d_inode; | ||
| 1550 | 1546 | ||
| 1551 | /* We can't create new files in nfs_open_revalidate(), so we | 1547 | /* We can't create new files in nfs_open_revalidate(), so we |
| 1552 | * optimize away revalidation of negative dentries. | 1548 | * optimize away revalidation of negative dentries. |
| 1553 | */ | 1549 | */ |
| 1554 | if (inode == NULL) { | 1550 | if (inode == NULL) { |
| 1551 | struct dentry *parent; | ||
| 1552 | struct inode *dir; | ||
| 1553 | |||
| 1554 | parent = dget_parent(dentry); | ||
| 1555 | dir = parent->d_inode; | ||
| 1555 | if (!nfs_neg_need_reval(dir, dentry, flags)) | 1556 | if (!nfs_neg_need_reval(dir, dentry, flags)) |
| 1556 | ret = 1; | 1557 | ret = 1; |
| 1558 | dput(parent); | ||
| 1557 | goto out; | 1559 | goto out; |
| 1558 | } | 1560 | } |
| 1559 | 1561 | ||
| 1560 | /* NFS only supports OPEN on regular files */ | 1562 | /* NFS only supports OPEN on regular files */ |
| 1561 | if (!S_ISREG(inode->i_mode)) | 1563 | if (!S_ISREG(inode->i_mode)) |
| 1562 | goto no_open_dput; | 1564 | goto no_open; |
| 1563 | /* We cannot do exclusive creation on a positive dentry */ | 1565 | /* We cannot do exclusive creation on a positive dentry */ |
| 1564 | if (flags & LOOKUP_EXCL) | 1566 | if (flags & LOOKUP_EXCL) |
| 1565 | goto no_open_dput; | 1567 | goto no_open; |
| 1566 | 1568 | ||
| 1567 | /* Let f_op->open() actually open (and revalidate) the file */ | 1569 | /* Let f_op->open() actually open (and revalidate) the file */ |
| 1568 | ret = 1; | 1570 | ret = 1; |
| 1569 | 1571 | ||
| 1570 | out: | 1572 | out: |
| 1571 | dput(parent); | ||
| 1572 | return ret; | 1573 | return ret; |
| 1573 | 1574 | ||
| 1574 | no_open_dput: | ||
| 1575 | dput(parent); | ||
| 1576 | no_open: | 1575 | no_open: |
| 1577 | return nfs_lookup_revalidate(dentry, flags); | 1576 | return nfs_lookup_revalidate(dentry, flags); |
| 1578 | } | 1577 | } |
