aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfs/dir.c24
1 files changed, 4 insertions, 20 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 0432f474771b..e6d55dc93ffd 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -1366,24 +1366,6 @@ const struct dentry_operations nfs4_dentry_operations = {
1366 .d_release = nfs_d_release, 1366 .d_release = nfs_d_release,
1367}; 1367};
1368 1368
1369/*
1370 * Use intent information to determine whether we need to substitute
1371 * the NFSv4-style stateful OPEN for the LOOKUP call
1372 */
1373static int is_atomic_open(struct nameidata *nd)
1374{
1375 if (nd == NULL || nfs_lookup_check_intent(nd, LOOKUP_OPEN) == 0)
1376 return 0;
1377 /* NFS does not (yet) have a stateful open for directories */
1378 if (nd->flags & LOOKUP_DIRECTORY)
1379 return 0;
1380 /* Are we trying to write to a read only partition? */
1381 if (__mnt_is_readonly(nd->path.mnt) &&
1382 (nd->intent.open.flags & (O_CREAT|O_TRUNC|O_ACCMODE)))
1383 return 0;
1384 return 1;
1385}
1386
1387static fmode_t flags_to_mode(int flags) 1369static fmode_t flags_to_mode(int flags)
1388{ 1370{
1389 fmode_t res = (__force fmode_t)flags & FMODE_EXEC; 1371 fmode_t res = (__force fmode_t)flags & FMODE_EXEC;
@@ -1543,10 +1525,12 @@ static int nfs4_lookup_revalidate(struct dentry *dentry, struct nameidata *nd)
1543 if (nd->flags & LOOKUP_RCU) 1525 if (nd->flags & LOOKUP_RCU)
1544 return -ECHILD; 1526 return -ECHILD;
1545 1527
1546 inode = dentry->d_inode; 1528 if (!(nd->flags & LOOKUP_OPEN) || (nd->flags & LOOKUP_DIRECTORY))
1547 if (!is_atomic_open(nd) || d_mountpoint(dentry)) 1529 goto no_open;
1530 if (d_mountpoint(dentry))
1548 goto no_open; 1531 goto no_open;
1549 1532
1533 inode = dentry->d_inode;
1550 parent = dget_parent(dentry); 1534 parent = dget_parent(dentry);
1551 dir = parent->d_inode; 1535 dir = parent->d_inode;
1552 1536