]> git.karo-electronics.de Git - linux-beck.git/blobdiff - fs/9p/vfs_inode_dotl.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[linux-beck.git] / fs / 9p / vfs_inode_dotl.c
index 7c295588150c46e846ad58ff8d1c72167f405d8d..61e4fa70a6fa7751e85e68411e9d2ba3538b375e 100644 (file)
@@ -57,7 +57,7 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, umode_t omode,
  * group of the new file system object.
  */
 
-static gid_t v9fs_get_fsgid_for_create(struct inode *dir_inode)
+static kgid_t v9fs_get_fsgid_for_create(struct inode *dir_inode)
 {
        BUG_ON(dir_inode == NULL);
 
@@ -186,7 +186,6 @@ static int v9fs_mapped_dotl_flags(int flags)
                { O_CREAT,      P9_DOTL_CREATE },
                { O_EXCL,       P9_DOTL_EXCL },
                { O_NOCTTY,     P9_DOTL_NOCTTY },
-               { O_TRUNC,      P9_DOTL_TRUNC },
                { O_APPEND,     P9_DOTL_APPEND },
                { O_NONBLOCK,   P9_DOTL_NONBLOCK },
                { O_DSYNC,      P9_DOTL_DSYNC },
@@ -246,7 +245,7 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry,
                          int *opened)
 {
        int err = 0;
-       gid_t gid;
+       kgid_t gid;
        umode_t mode;
        char *name = NULL;
        struct p9_qid qid;
@@ -268,8 +267,14 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry,
        }
 
        /* Only creates */
-       if (!(flags & O_CREAT) || dentry->d_inode)
-               return finish_no_open(file, res);
+       if (!(flags & O_CREAT))
+               return  finish_no_open(file, res);
+       else if (dentry->d_inode) {
+               if ((flags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL))
+                       return -EEXIST;
+               else
+                       return finish_no_open(file, res);
+       }
 
        v9ses = v9fs_inode2v9ses(dir);
 
@@ -391,7 +396,7 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir,
        int err;
        struct v9fs_session_info *v9ses;
        struct p9_fid *fid = NULL, *dfid = NULL;
-       gid_t gid;
+       kgid_t gid;
        char *name;
        umode_t mode;
        struct inode *inode;
@@ -693,7 +698,7 @@ v9fs_vfs_symlink_dotl(struct inode *dir, struct dentry *dentry,
                const char *symname)
 {
        int err;
-       gid_t gid;
+       kgid_t gid;
        char *name;
        struct p9_qid qid;
        struct inode *inode;
@@ -833,7 +838,7 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, umode_t omode,
                dev_t rdev)
 {
        int err;
-       gid_t gid;
+       kgid_t gid;
        char *name;
        umode_t mode;
        struct v9fs_session_info *v9ses;