[PATCH] switch quota_on-related stuff to kern_path()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
10
fs/dquot.c
10
fs/dquot.c
@@ -1805,19 +1805,19 @@ int vfs_quota_on_path(struct super_block *sb, int type, int format_id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Actual function called from quotactl() */
|
/* Actual function called from quotactl() */
|
||||||
int vfs_quota_on(struct super_block *sb, int type, int format_id, char *path,
|
int vfs_quota_on(struct super_block *sb, int type, int format_id, char *name,
|
||||||
int remount)
|
int remount)
|
||||||
{
|
{
|
||||||
struct nameidata nd;
|
struct path path;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
if (remount)
|
if (remount)
|
||||||
return vfs_quota_on_remount(sb, type);
|
return vfs_quota_on_remount(sb, type);
|
||||||
|
|
||||||
error = path_lookup(path, LOOKUP_FOLLOW, &nd);
|
error = kern_path(name, LOOKUP_FOLLOW, &path);
|
||||||
if (!error) {
|
if (!error) {
|
||||||
error = vfs_quota_on_path(sb, type, format_id, &nd.path);
|
error = vfs_quota_on_path(sb, type, format_id, &path);
|
||||||
path_put(&nd.path);
|
path_put(&path);
|
||||||
}
|
}
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
@@ -2783,30 +2783,30 @@ static int ext3_quota_on_mount(struct super_block *sb, int type)
|
|||||||
* Standard function to be called on quota_on
|
* Standard function to be called on quota_on
|
||||||
*/
|
*/
|
||||||
static int ext3_quota_on(struct super_block *sb, int type, int format_id,
|
static int ext3_quota_on(struct super_block *sb, int type, int format_id,
|
||||||
char *path, int remount)
|
char *name, int remount)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
struct nameidata nd;
|
struct path path;
|
||||||
|
|
||||||
if (!test_opt(sb, QUOTA))
|
if (!test_opt(sb, QUOTA))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
/* When remounting, no checks are needed and in fact, path is NULL */
|
/* When remounting, no checks are needed and in fact, name is NULL */
|
||||||
if (remount)
|
if (remount)
|
||||||
return vfs_quota_on(sb, type, format_id, path, remount);
|
return vfs_quota_on(sb, type, format_id, name, remount);
|
||||||
|
|
||||||
err = path_lookup(path, LOOKUP_FOLLOW, &nd);
|
err = kern_path(name, LOOKUP_FOLLOW, &path);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
/* Quotafile not on the same filesystem? */
|
/* Quotafile not on the same filesystem? */
|
||||||
if (nd.path.mnt->mnt_sb != sb) {
|
if (path.mnt->mnt_sb != sb) {
|
||||||
path_put(&nd.path);
|
path_put(&path);
|
||||||
return -EXDEV;
|
return -EXDEV;
|
||||||
}
|
}
|
||||||
/* Journaling quota? */
|
/* Journaling quota? */
|
||||||
if (EXT3_SB(sb)->s_qf_names[type]) {
|
if (EXT3_SB(sb)->s_qf_names[type]) {
|
||||||
/* Quotafile not of fs root? */
|
/* Quotafile not of fs root? */
|
||||||
if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode)
|
if (path.dentry->d_parent != sb->s_root)
|
||||||
printk(KERN_WARNING
|
printk(KERN_WARNING
|
||||||
"EXT3-fs: Quota file not on filesystem root. "
|
"EXT3-fs: Quota file not on filesystem root. "
|
||||||
"Journaled quota will not work.\n");
|
"Journaled quota will not work.\n");
|
||||||
@@ -2816,7 +2816,7 @@ static int ext3_quota_on(struct super_block *sb, int type, int format_id,
|
|||||||
* When we journal data on quota file, we have to flush journal to see
|
* When we journal data on quota file, we have to flush journal to see
|
||||||
* all updates to the file when we bypass pagecache...
|
* all updates to the file when we bypass pagecache...
|
||||||
*/
|
*/
|
||||||
if (ext3_should_journal_data(nd.path.dentry->d_inode)) {
|
if (ext3_should_journal_data(path.dentry->d_inode)) {
|
||||||
/*
|
/*
|
||||||
* We don't need to lock updates but journal_flush() could
|
* We don't need to lock updates but journal_flush() could
|
||||||
* otherwise be livelocked...
|
* otherwise be livelocked...
|
||||||
@@ -2826,8 +2826,8 @@ static int ext3_quota_on(struct super_block *sb, int type, int format_id,
|
|||||||
journal_unlock_updates(EXT3_SB(sb)->s_journal);
|
journal_unlock_updates(EXT3_SB(sb)->s_journal);
|
||||||
}
|
}
|
||||||
|
|
||||||
err = vfs_quota_on_path(sb, type, format_id, &nd.path);
|
err = vfs_quota_on_path(sb, type, format_id, &path);
|
||||||
path_put(&nd.path);
|
path_put(&path);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -3328,30 +3328,30 @@ static int ext4_quota_on_mount(struct super_block *sb, int type)
|
|||||||
* Standard function to be called on quota_on
|
* Standard function to be called on quota_on
|
||||||
*/
|
*/
|
||||||
static int ext4_quota_on(struct super_block *sb, int type, int format_id,
|
static int ext4_quota_on(struct super_block *sb, int type, int format_id,
|
||||||
char *path, int remount)
|
char *name, int remount)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
struct nameidata nd;
|
struct path path;
|
||||||
|
|
||||||
if (!test_opt(sb, QUOTA))
|
if (!test_opt(sb, QUOTA))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
/* When remounting, no checks are needed and in fact, path is NULL */
|
/* When remounting, no checks are needed and in fact, name is NULL */
|
||||||
if (remount)
|
if (remount)
|
||||||
return vfs_quota_on(sb, type, format_id, path, remount);
|
return vfs_quota_on(sb, type, format_id, name, remount);
|
||||||
|
|
||||||
err = path_lookup(path, LOOKUP_FOLLOW, &nd);
|
err = kern_path(name, LOOKUP_FOLLOW, &path);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
/* Quotafile not on the same filesystem? */
|
/* Quotafile not on the same filesystem? */
|
||||||
if (nd.path.mnt->mnt_sb != sb) {
|
if (path.mnt->mnt_sb != sb) {
|
||||||
path_put(&nd.path);
|
path_put(&path);
|
||||||
return -EXDEV;
|
return -EXDEV;
|
||||||
}
|
}
|
||||||
/* Journaling quota? */
|
/* Journaling quota? */
|
||||||
if (EXT4_SB(sb)->s_qf_names[type]) {
|
if (EXT4_SB(sb)->s_qf_names[type]) {
|
||||||
/* Quotafile not in fs root? */
|
/* Quotafile not in fs root? */
|
||||||
if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode)
|
if (path.dentry->d_parent != sb->s_root)
|
||||||
printk(KERN_WARNING
|
printk(KERN_WARNING
|
||||||
"EXT4-fs: Quota file not on filesystem root. "
|
"EXT4-fs: Quota file not on filesystem root. "
|
||||||
"Journaled quota will not work.\n");
|
"Journaled quota will not work.\n");
|
||||||
@@ -3361,7 +3361,7 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id,
|
|||||||
* When we journal data on quota file, we have to flush journal to see
|
* When we journal data on quota file, we have to flush journal to see
|
||||||
* all updates to the file when we bypass pagecache...
|
* all updates to the file when we bypass pagecache...
|
||||||
*/
|
*/
|
||||||
if (ext4_should_journal_data(nd.path.dentry->d_inode)) {
|
if (ext4_should_journal_data(path.dentry->d_inode)) {
|
||||||
/*
|
/*
|
||||||
* We don't need to lock updates but journal_flush() could
|
* We don't need to lock updates but journal_flush() could
|
||||||
* otherwise be livelocked...
|
* otherwise be livelocked...
|
||||||
@@ -3370,13 +3370,13 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id,
|
|||||||
err = jbd2_journal_flush(EXT4_SB(sb)->s_journal);
|
err = jbd2_journal_flush(EXT4_SB(sb)->s_journal);
|
||||||
jbd2_journal_unlock_updates(EXT4_SB(sb)->s_journal);
|
jbd2_journal_unlock_updates(EXT4_SB(sb)->s_journal);
|
||||||
if (err) {
|
if (err) {
|
||||||
path_put(&nd.path);
|
path_put(&path);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err = vfs_quota_on_path(sb, type, format_id, &nd.path);
|
err = vfs_quota_on_path(sb, type, format_id, &path);
|
||||||
path_put(&nd.path);
|
path_put(&path);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2058,10 +2058,10 @@ static int reiserfs_quota_on_mount(struct super_block *sb, int type)
|
|||||||
* Standard function to be called on quota_on
|
* Standard function to be called on quota_on
|
||||||
*/
|
*/
|
||||||
static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
|
static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
|
||||||
char *path, int remount)
|
char *name, int remount)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
struct nameidata nd;
|
struct path path;
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
struct reiserfs_transaction_handle th;
|
struct reiserfs_transaction_handle th;
|
||||||
|
|
||||||
@@ -2069,16 +2069,16 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
/* No more checks needed? Path and format_id are bogus anyway... */
|
/* No more checks needed? Path and format_id are bogus anyway... */
|
||||||
if (remount)
|
if (remount)
|
||||||
return vfs_quota_on(sb, type, format_id, path, 1);
|
return vfs_quota_on(sb, type, format_id, name, 1);
|
||||||
err = path_lookup(path, LOOKUP_FOLLOW, &nd);
|
err = kern_path(name, LOOKUP_FOLLOW, &path);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
/* Quotafile not on the same filesystem? */
|
/* Quotafile not on the same filesystem? */
|
||||||
if (nd.path.mnt->mnt_sb != sb) {
|
if (path.mnt->mnt_sb != sb) {
|
||||||
err = -EXDEV;
|
err = -EXDEV;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
inode = nd.path.dentry->d_inode;
|
inode = path.dentry->d_inode;
|
||||||
/* We must not pack tails for quota files on reiserfs for quota IO to work */
|
/* We must not pack tails for quota files on reiserfs for quota IO to work */
|
||||||
if (!(REISERFS_I(inode)->i_flags & i_nopack_mask)) {
|
if (!(REISERFS_I(inode)->i_flags & i_nopack_mask)) {
|
||||||
err = reiserfs_unpack(inode, NULL);
|
err = reiserfs_unpack(inode, NULL);
|
||||||
@@ -2094,7 +2094,7 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
|
|||||||
/* Journaling quota? */
|
/* Journaling quota? */
|
||||||
if (REISERFS_SB(sb)->s_qf_names[type]) {
|
if (REISERFS_SB(sb)->s_qf_names[type]) {
|
||||||
/* Quotafile not of fs root? */
|
/* Quotafile not of fs root? */
|
||||||
if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode)
|
if (path.dentry->d_parent != sb->s_root)
|
||||||
reiserfs_warning(sb,
|
reiserfs_warning(sb,
|
||||||
"reiserfs: Quota file not on filesystem root. "
|
"reiserfs: Quota file not on filesystem root. "
|
||||||
"Journalled quota will not work.");
|
"Journalled quota will not work.");
|
||||||
@@ -2113,9 +2113,9 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
|
|||||||
if (err)
|
if (err)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
err = vfs_quota_on_path(sb, type, format_id, &nd.path);
|
err = vfs_quota_on_path(sb, type, format_id, &path);
|
||||||
out:
|
out:
|
||||||
path_put(&nd.path);
|
path_put(&path);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user