quota: add possibly missing iput() when quotaon and quotaoff races
[sfrench/cifs-2.6.git] / fs / dquot.c
index def4e969df77646192eb6ce96d223a1f78ec4544..41b9dbd68b0e88e4a466685e1150e262e5d03c59 100644 (file)
@@ -1522,8 +1522,8 @@ int vfs_quota_off(struct super_block *sb, int type)
                                truncate_inode_pages(&toputinode[cnt]->i_data, 0);
                                mutex_unlock(&toputinode[cnt]->i_mutex);
                                mark_inode_dirty(toputinode[cnt]);
-                               iput(toputinode[cnt]);
                        }
+                       iput(toputinode[cnt]);
                        mutex_unlock(&dqopt->dqonoff_mutex);
                }
        if (sb->s_bdev)
@@ -1633,16 +1633,17 @@ int vfs_quota_on(struct super_block *sb, int type, int format_id, char *path)
        error = path_lookup(path, LOOKUP_FOLLOW, &nd);
        if (error < 0)
                return error;
-       error = security_quota_on(nd.dentry);
+       error = security_quota_on(nd.path.dentry);
        if (error)
                goto out_path;
        /* Quota file not on the same filesystem? */
-       if (nd.mnt->mnt_sb != sb)
+       if (nd.path.mnt->mnt_sb != sb)
                error = -EXDEV;
        else
-               error = vfs_quota_on_inode(nd.dentry->d_inode, type, format_id);
+               error = vfs_quota_on_inode(nd.path.dentry->d_inode, type,
+                                          format_id);
 out_path:
-       path_release(&nd);
+       path_put(&nd.path);
        return error;
 }