aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/dir.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/dir.c')
-rw-r--r--fs/nfs/dir.c26
1 files changed, 3 insertions, 23 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 743d3b524fc5..c3f21888654f 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -1385,18 +1385,6 @@ static int nfs_finish_open(struct nfs_open_context *ctx,
1385{ 1385{
1386 int err; 1386 int err;
1387 1387
1388 if (ctx->dentry != dentry) {
1389 dput(ctx->dentry);
1390 ctx->dentry = dget(dentry);
1391 }
1392
1393 /* If the open_intent is for execute, we have an extra check to make */
1394 if (ctx->mode & FMODE_EXEC) {
1395 err = nfs_may_open(dentry->d_inode, ctx->cred, open_flags);
1396 if (err < 0)
1397 goto out;
1398 }
1399
1400 err = finish_open(file, dentry, do_open, opened); 1388 err = finish_open(file, dentry, do_open, opened);
1401 if (err) 1389 if (err)
1402 goto out; 1390 goto out;
@@ -1455,13 +1443,13 @@ int nfs_atomic_open(struct inode *dir, struct dentry *dentry,
1455 1443
1456 nfs_block_sillyrename(dentry->d_parent); 1444 nfs_block_sillyrename(dentry->d_parent);
1457 inode = NFS_PROTO(dir)->open_context(dir, ctx, open_flags, &attr); 1445 inode = NFS_PROTO(dir)->open_context(dir, ctx, open_flags, &attr);
1458 d_drop(dentry); 1446 nfs_unblock_sillyrename(dentry->d_parent);
1459 if (IS_ERR(inode)) { 1447 if (IS_ERR(inode)) {
1460 nfs_unblock_sillyrename(dentry->d_parent);
1461 put_nfs_open_context(ctx); 1448 put_nfs_open_context(ctx);
1462 err = PTR_ERR(inode); 1449 err = PTR_ERR(inode);
1463 switch (err) { 1450 switch (err) {
1464 case -ENOENT: 1451 case -ENOENT:
1452 d_drop(dentry);
1465 d_add(dentry, NULL); 1453 d_add(dentry, NULL);
1466 break; 1454 break;
1467 case -EISDIR: 1455 case -EISDIR:
@@ -1477,16 +1465,8 @@ int nfs_atomic_open(struct inode *dir, struct dentry *dentry,
1477 } 1465 }
1478 goto out; 1466 goto out;
1479 } 1467 }
1480 res = d_add_unique(dentry, inode);
1481 if (res != NULL)
1482 dentry = res;
1483
1484 nfs_unblock_sillyrename(dentry->d_parent);
1485 nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
1486
1487 err = nfs_finish_open(ctx, dentry, file, open_flags, opened);
1488 1468
1489 dput(res); 1469 err = nfs_finish_open(ctx, ctx->dentry, file, open_flags, opened);
1490out: 1470out:
1491 return err; 1471 return err;
1492 1472