aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/dir.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ceph/dir.c')
-rw-r--r--fs/ceph/dir.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index 81e5e908df9d..d8bfabeeaa25 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -634,21 +634,20 @@ static struct dentry *ceph_lookup(struct inode *dir, struct dentry *dentry,
634 return dentry; 634 return dentry;
635} 635}
636 636
637struct file *ceph_atomic_open(struct inode *dir, struct dentry *dentry, 637int ceph_atomic_open(struct inode *dir, struct dentry *dentry,
638 struct opendata *od, unsigned flags, umode_t mode, 638 struct opendata *od, unsigned flags, umode_t mode,
639 int *opened) 639 int *opened)
640{ 640{
641 int err; 641 int err;
642 struct dentry *res = NULL; 642 struct dentry *res = NULL;
643 struct file *filp;
644 643
645 if (!(flags & O_CREAT)) { 644 if (!(flags & O_CREAT)) {
646 if (dentry->d_name.len > NAME_MAX) 645 if (dentry->d_name.len > NAME_MAX)
647 return ERR_PTR(-ENAMETOOLONG); 646 return -ENAMETOOLONG;
648 647
649 err = ceph_init_dentry(dentry); 648 err = ceph_init_dentry(dentry);
650 if (err < 0) 649 if (err < 0)
651 return ERR_PTR(err); 650 return err;
652 651
653 return ceph_lookup_open(dir, dentry, od, flags, mode, opened); 652 return ceph_lookup_open(dir, dentry, od, flags, mode, opened);
654 } 653 }
@@ -656,7 +655,7 @@ struct file *ceph_atomic_open(struct inode *dir, struct dentry *dentry,
656 if (d_unhashed(dentry)) { 655 if (d_unhashed(dentry)) {
657 res = ceph_lookup(dir, dentry, NULL); 656 res = ceph_lookup(dir, dentry, NULL);
658 if (IS_ERR(res)) 657 if (IS_ERR(res))
659 return ERR_CAST(res); 658 return PTR_ERR(res);
660 659
661 if (res) 660 if (res)
662 dentry = res; 661 dentry = res;
@@ -665,14 +664,14 @@ struct file *ceph_atomic_open(struct inode *dir, struct dentry *dentry,
665 /* We don't deal with positive dentries here */ 664 /* We don't deal with positive dentries here */
666 if (dentry->d_inode) { 665 if (dentry->d_inode) {
667 finish_no_open(od, res); 666 finish_no_open(od, res);
668 return NULL; 667 return 1;
669 } 668 }
670 669
671 *opened |= FILE_CREATED; 670 *opened |= FILE_CREATED;
672 filp = ceph_lookup_open(dir, dentry, od, flags, mode, opened); 671 err = ceph_lookup_open(dir, dentry, od, flags, mode, opened);
673 dput(res); 672 dput(res);
674 673
675 return filp; 674 return err;
676} 675}
677 676
678/* 677/*