These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / fs / jfs / namei.c
index 66db7bc..9d7551f 100644 (file)
@@ -86,7 +86,9 @@ static int jfs_create(struct inode *dip, struct dentry *dentry, umode_t mode,
 
        jfs_info("jfs_create: dip:0x%p name:%pd", dip, dentry);
 
-       dquot_initialize(dip);
+       rc = dquot_initialize(dip);
+       if (rc)
+               goto out1;
 
        /*
         * search parent directory for entry/freespace
@@ -218,7 +220,9 @@ static int jfs_mkdir(struct inode *dip, struct dentry *dentry, umode_t mode)
 
        jfs_info("jfs_mkdir: dip:0x%p name:%pd", dip, dentry);
 
-       dquot_initialize(dip);
+       rc = dquot_initialize(dip);
+       if (rc)
+               goto out1;
 
        /*
         * search parent directory for entry/freespace
@@ -355,8 +359,12 @@ static int jfs_rmdir(struct inode *dip, struct dentry *dentry)
        jfs_info("jfs_rmdir: dip:0x%p name:%pd", dip, dentry);
 
        /* Init inode for quota operations. */
-       dquot_initialize(dip);
-       dquot_initialize(ip);
+       rc = dquot_initialize(dip);
+       if (rc)
+               goto out;
+       rc = dquot_initialize(ip);
+       if (rc)
+               goto out;
 
        /* directory must be empty to be removed */
        if (!dtEmpty(ip)) {
@@ -483,8 +491,12 @@ static int jfs_unlink(struct inode *dip, struct dentry *dentry)
        jfs_info("jfs_unlink: dip:0x%p name:%pd", dip, dentry);
 
        /* Init inode for quota operations. */
-       dquot_initialize(dip);
-       dquot_initialize(ip);
+       rc = dquot_initialize(dip);
+       if (rc)
+               goto out;
+       rc = dquot_initialize(ip);
+       if (rc)
+               goto out;
 
        if ((rc = get_UCSname(&dname, dentry)))
                goto out;
@@ -799,7 +811,9 @@ static int jfs_link(struct dentry *old_dentry,
 
        jfs_info("jfs_link: %pd %pd", old_dentry, dentry);
 
-       dquot_initialize(dir);
+       rc = dquot_initialize(dir);
+       if (rc)
+               goto out;
 
        tid = txBegin(ip->i_sb, 0);
 
@@ -810,7 +824,7 @@ static int jfs_link(struct dentry *old_dentry,
         * scan parent directory for entry/freespace
         */
        if ((rc = get_UCSname(&dname, dentry)))
-               goto out;
+               goto out_tx;
 
        if ((rc = dtSearch(dir, &dname, &ino, &btstack, JFS_CREATE)))
                goto free_dname;
@@ -842,12 +856,13 @@ static int jfs_link(struct dentry *old_dentry,
       free_dname:
        free_UCSname(&dname);
 
-      out:
+      out_tx:
        txEnd(tid);
 
        mutex_unlock(&JFS_IP(ip)->commit_mutex);
        mutex_unlock(&JFS_IP(dir)->commit_mutex);
 
+      out:
        jfs_info("jfs_link: rc:%d", rc);
        return rc;
 }
@@ -880,7 +895,6 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry,
        int ssize;              /* source pathname size */
        struct btstack btstack;
        struct inode *ip = d_inode(dentry);
-       unchar *i_fastsymlink;
        s64 xlen = 0;
        int bmask = 0, xsize;
        s64 xaddr;
@@ -892,7 +906,9 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry,
 
        jfs_info("jfs_symlink: dip:0x%p name:%s", dip, name);
 
-       dquot_initialize(dip);
+       rc = dquot_initialize(dip);
+       if (rc)
+               goto out1;
 
        ssize = strlen(name) + 1;
 
@@ -946,8 +962,8 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry,
        if (ssize <= IDATASIZE) {
                ip->i_op = &jfs_fast_symlink_inode_operations;
 
-               i_fastsymlink = JFS_IP(ip)->i_inline;
-               memcpy(i_fastsymlink, name, ssize);
+               ip->i_link = JFS_IP(ip)->i_inline;
+               memcpy(ip->i_link, name, ssize);
                ip->i_size = ssize - 1;
 
                /*
@@ -1083,8 +1099,12 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 
        jfs_info("jfs_rename: %pd %pd", old_dentry, new_dentry);
 
-       dquot_initialize(old_dir);
-       dquot_initialize(new_dir);
+       rc = dquot_initialize(old_dir);
+       if (rc)
+               goto out1;
+       rc = dquot_initialize(new_dir);
+       if (rc)
+               goto out1;
 
        old_ip = d_inode(old_dentry);
        new_ip = d_inode(new_dentry);
@@ -1131,7 +1151,9 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
        } else if (new_ip) {
                IWRITE_LOCK(new_ip, RDWRLOCK_NORMAL);
                /* Init inode for quota operations. */
-               dquot_initialize(new_ip);
+               rc = dquot_initialize(new_ip);
+               if (rc)
+                       goto out_unlock;
        }
 
        /*
@@ -1161,7 +1183,7 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
                rc = dtModify(tid, new_dir, &new_dname, &ino,
                              old_ip->i_ino, JFS_RENAME);
                if (rc)
-                       goto out4;
+                       goto out_tx;
                drop_nlink(new_ip);
                if (S_ISDIR(new_ip->i_mode)) {
                        drop_nlink(new_ip);
@@ -1186,7 +1208,7 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
                        if ((new_size = commitZeroLink(tid, new_ip)) < 0) {
                                txAbort(tid, 1);        /* Marks FS Dirty */
                                rc = new_size;
-                               goto out4;
+                               goto out_tx;
                        }
                        tblk = tid_to_tblock(tid);
                        tblk->xflag |= COMMIT_DELETE;
@@ -1204,7 +1226,7 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
                if (rc) {
                        jfs_err("jfs_rename didn't expect dtSearch to fail "
                                "w/rc = %d", rc);
-                       goto out4;
+                       goto out_tx;
                }
 
                ino = old_ip->i_ino;
@@ -1212,7 +1234,7 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
                if (rc) {
                        if (rc == -EIO)
                                jfs_err("jfs_rename: dtInsert returned -EIO");
-                       goto out4;
+                       goto out_tx;
                }
                if (S_ISDIR(old_ip->i_mode))
                        inc_nlink(new_dir);
@@ -1227,7 +1249,7 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
                jfs_err("jfs_rename did not expect dtDelete to return rc = %d",
                        rc);
                txAbort(tid, 1);        /* Marks Filesystem dirty */
-               goto out4;
+               goto out_tx;
        }
        if (S_ISDIR(old_ip->i_mode)) {
                drop_nlink(old_dir);
@@ -1286,7 +1308,7 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 
        rc = txCommit(tid, ipcount, iplist, commit_flag);
 
-      out4:
+      out_tx:
        txEnd(tid);
        if (new_ip)
                mutex_unlock(&JFS_IP(new_ip)->commit_mutex);
@@ -1309,13 +1331,6 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
        }
        if (new_ip && (new_ip->i_nlink == 0))
                set_cflag(COMMIT_Nolink, new_ip);
-      out3:
-       free_UCSname(&new_dname);
-      out2:
-       free_UCSname(&old_dname);
-      out1:
-       if (new_ip && !S_ISDIR(new_ip->i_mode))
-               IWRITE_UNLOCK(new_ip);
        /*
         * Truncating the directory index table is not guaranteed.  It
         * may need to be done iteratively
@@ -1326,7 +1341,14 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 
                clear_cflag(COMMIT_Stale, old_dir);
        }
-
+      out_unlock:
+       if (new_ip && !S_ISDIR(new_ip->i_mode))
+               IWRITE_UNLOCK(new_ip);
+      out3:
+       free_UCSname(&new_dname);
+      out2:
+       free_UCSname(&old_dname);
+      out1:
        jfs_info("jfs_rename: returning %d", rc);
        return rc;
 }
@@ -1350,12 +1372,11 @@ static int jfs_mknod(struct inode *dir, struct dentry *dentry,
        tid_t tid;
        struct tblock *tblk;
 
-       if (!new_valid_dev(rdev))
-               return -EINVAL;
-
        jfs_info("jfs_mknod: %pd", dentry);
 
-       dquot_initialize(dir);
+       rc = dquot_initialize(dir);
+       if (rc)
+               goto out;
 
        if ((rc = get_UCSname(&dname, dentry)))
                goto out;