Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] switch quota_on-related stuff to kern_path()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro 8264613d 0a0d8a46

+37 -37
+5 -5
fs/dquot.c
··· 1805 1805 } 1806 1806 1807 1807 /* Actual function called from quotactl() */ 1808 - int vfs_quota_on(struct super_block *sb, int type, int format_id, char *path, 1808 + int vfs_quota_on(struct super_block *sb, int type, int format_id, char *name, 1809 1809 int remount) 1810 1810 { 1811 - struct nameidata nd; 1811 + struct path path; 1812 1812 int error; 1813 1813 1814 1814 if (remount) 1815 1815 return vfs_quota_on_remount(sb, type); 1816 1816 1817 - error = path_lookup(path, LOOKUP_FOLLOW, &nd); 1817 + error = kern_path(name, LOOKUP_FOLLOW, &path); 1818 1818 if (!error) { 1819 - error = vfs_quota_on_path(sb, type, format_id, &nd.path); 1820 - path_put(&nd.path); 1819 + error = vfs_quota_on_path(sb, type, format_id, &path); 1820 + path_put(&path); 1821 1821 } 1822 1822 return error; 1823 1823 }
+11 -11
fs/ext3/super.c
··· 2783 2783 * Standard function to be called on quota_on 2784 2784 */ 2785 2785 static int ext3_quota_on(struct super_block *sb, int type, int format_id, 2786 - char *path, int remount) 2786 + char *name, int remount) 2787 2787 { 2788 2788 int err; 2789 - struct nameidata nd; 2789 + struct path path; 2790 2790 2791 2791 if (!test_opt(sb, QUOTA)) 2792 2792 return -EINVAL; 2793 - /* When remounting, no checks are needed and in fact, path is NULL */ 2793 + /* When remounting, no checks are needed and in fact, name is NULL */ 2794 2794 if (remount) 2795 - return vfs_quota_on(sb, type, format_id, path, remount); 2795 + return vfs_quota_on(sb, type, format_id, name, remount); 2796 2796 2797 - err = path_lookup(path, LOOKUP_FOLLOW, &nd); 2797 + err = kern_path(name, LOOKUP_FOLLOW, &path); 2798 2798 if (err) 2799 2799 return err; 2800 2800 2801 2801 /* Quotafile not on the same filesystem? */ 2802 - if (nd.path.mnt->mnt_sb != sb) { 2803 - path_put(&nd.path); 2802 + if (path.mnt->mnt_sb != sb) { 2803 + path_put(&path); 2804 2804 return -EXDEV; 2805 2805 } 2806 2806 /* Journaling quota? */ 2807 2807 if (EXT3_SB(sb)->s_qf_names[type]) { 2808 2808 /* Quotafile not of fs root? */ 2809 - if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode) 2809 + if (path.dentry->d_parent != sb->s_root) 2810 2810 printk(KERN_WARNING 2811 2811 "EXT3-fs: Quota file not on filesystem root. " 2812 2812 "Journaled quota will not work.\n"); ··· 2816 2816 * When we journal data on quota file, we have to flush journal to see 2817 2817 * all updates to the file when we bypass pagecache... 2818 2818 */ 2819 - if (ext3_should_journal_data(nd.path.dentry->d_inode)) { 2819 + if (ext3_should_journal_data(path.dentry->d_inode)) { 2820 2820 /* 2821 2821 * We don't need to lock updates but journal_flush() could 2822 2822 * otherwise be livelocked... ··· 2826 2826 journal_unlock_updates(EXT3_SB(sb)->s_journal); 2827 2827 } 2828 2828 2829 - err = vfs_quota_on_path(sb, type, format_id, &nd.path); 2830 - path_put(&nd.path); 2829 + err = vfs_quota_on_path(sb, type, format_id, &path); 2830 + path_put(&path); 2831 2831 return err; 2832 2832 } 2833 2833
+12 -12
fs/ext4/super.c
··· 3328 3328 * Standard function to be called on quota_on 3329 3329 */ 3330 3330 static int ext4_quota_on(struct super_block *sb, int type, int format_id, 3331 - char *path, int remount) 3331 + char *name, int remount) 3332 3332 { 3333 3333 int err; 3334 - struct nameidata nd; 3334 + struct path path; 3335 3335 3336 3336 if (!test_opt(sb, QUOTA)) 3337 3337 return -EINVAL; 3338 - /* When remounting, no checks are needed and in fact, path is NULL */ 3338 + /* When remounting, no checks are needed and in fact, name is NULL */ 3339 3339 if (remount) 3340 - return vfs_quota_on(sb, type, format_id, path, remount); 3340 + return vfs_quota_on(sb, type, format_id, name, remount); 3341 3341 3342 - err = path_lookup(path, LOOKUP_FOLLOW, &nd); 3342 + err = kern_path(name, LOOKUP_FOLLOW, &path); 3343 3343 if (err) 3344 3344 return err; 3345 3345 3346 3346 /* Quotafile not on the same filesystem? */ 3347 - if (nd.path.mnt->mnt_sb != sb) { 3348 - path_put(&nd.path); 3347 + if (path.mnt->mnt_sb != sb) { 3348 + path_put(&path); 3349 3349 return -EXDEV; 3350 3350 } 3351 3351 /* Journaling quota? */ 3352 3352 if (EXT4_SB(sb)->s_qf_names[type]) { 3353 3353 /* Quotafile not in fs root? */ 3354 - if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode) 3354 + if (path.dentry->d_parent != sb->s_root) 3355 3355 printk(KERN_WARNING 3356 3356 "EXT4-fs: Quota file not on filesystem root. " 3357 3357 "Journaled quota will not work.\n"); ··· 3361 3361 * When we journal data on quota file, we have to flush journal to see 3362 3362 * all updates to the file when we bypass pagecache... 3363 3363 */ 3364 - if (ext4_should_journal_data(nd.path.dentry->d_inode)) { 3364 + if (ext4_should_journal_data(path.dentry->d_inode)) { 3365 3365 /* 3366 3366 * We don't need to lock updates but journal_flush() could 3367 3367 * otherwise be livelocked... ··· 3370 3370 err = jbd2_journal_flush(EXT4_SB(sb)->s_journal); 3371 3371 jbd2_journal_unlock_updates(EXT4_SB(sb)->s_journal); 3372 3372 if (err) { 3373 - path_put(&nd.path); 3373 + path_put(&path); 3374 3374 return err; 3375 3375 } 3376 3376 } 3377 3377 3378 - err = vfs_quota_on_path(sb, type, format_id, &nd.path); 3379 - path_put(&nd.path); 3378 + err = vfs_quota_on_path(sb, type, format_id, &path); 3379 + path_put(&path); 3380 3380 return err; 3381 3381 } 3382 3382
+9 -9
fs/reiserfs/super.c
··· 2058 2058 * Standard function to be called on quota_on 2059 2059 */ 2060 2060 static int reiserfs_quota_on(struct super_block *sb, int type, int format_id, 2061 - char *path, int remount) 2061 + char *name, int remount) 2062 2062 { 2063 2063 int err; 2064 - struct nameidata nd; 2064 + struct path path; 2065 2065 struct inode *inode; 2066 2066 struct reiserfs_transaction_handle th; 2067 2067 ··· 2069 2069 return -EINVAL; 2070 2070 /* No more checks needed? Path and format_id are bogus anyway... */ 2071 2071 if (remount) 2072 - return vfs_quota_on(sb, type, format_id, path, 1); 2073 - err = path_lookup(path, LOOKUP_FOLLOW, &nd); 2072 + return vfs_quota_on(sb, type, format_id, name, 1); 2073 + err = kern_path(name, LOOKUP_FOLLOW, &path); 2074 2074 if (err) 2075 2075 return err; 2076 2076 /* Quotafile not on the same filesystem? */ 2077 - if (nd.path.mnt->mnt_sb != sb) { 2077 + if (path.mnt->mnt_sb != sb) { 2078 2078 err = -EXDEV; 2079 2079 goto out; 2080 2080 } 2081 - inode = nd.path.dentry->d_inode; 2081 + inode = path.dentry->d_inode; 2082 2082 /* We must not pack tails for quota files on reiserfs for quota IO to work */ 2083 2083 if (!(REISERFS_I(inode)->i_flags & i_nopack_mask)) { 2084 2084 err = reiserfs_unpack(inode, NULL); ··· 2094 2094 /* Journaling quota? */ 2095 2095 if (REISERFS_SB(sb)->s_qf_names[type]) { 2096 2096 /* Quotafile not of fs root? */ 2097 - if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode) 2097 + if (path.dentry->d_parent != sb->s_root) 2098 2098 reiserfs_warning(sb, 2099 2099 "reiserfs: Quota file not on filesystem root. " 2100 2100 "Journalled quota will not work."); ··· 2113 2113 if (err) 2114 2114 goto out; 2115 2115 } 2116 - err = vfs_quota_on_path(sb, type, format_id, &nd.path); 2116 + err = vfs_quota_on_path(sb, type, format_id, &path); 2117 2117 out: 2118 - path_put(&nd.path); 2118 + path_put(&path); 2119 2119 return err; 2120 2120 } 2121 2121