ext4: prevent parallel resizers by atomic bit ops
Before this patch, parallel resizers are allowed and protected by a mutex lock, actually, there is no need to support parallel resizer, so this patch prevents parallel resizers by atmoic bit ops, like lock_page() and unlock_page() do. To do this, the patch removed the mutex lock s_resize_lock from struct ext4_sb_info and added a unsigned long field named s_resize_flags which inidicates if there is a resizer. Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
This commit is contained in:

committed by
Theodore Ts'o

parent
2d859db3e4
commit
8f82f840ec
@@ -202,8 +202,9 @@ setversion_out:
|
||||
struct super_block *sb = inode->i_sb;
|
||||
int err, err2=0;
|
||||
|
||||
if (!capable(CAP_SYS_RESOURCE))
|
||||
return -EPERM;
|
||||
err = ext4_resize_begin(sb);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (get_user(n_blocks_count, (__u32 __user *)arg))
|
||||
return -EFAULT;
|
||||
@@ -221,6 +222,7 @@ setversion_out:
|
||||
if (err == 0)
|
||||
err = err2;
|
||||
mnt_drop_write(filp->f_path.mnt);
|
||||
ext4_resize_end(sb);
|
||||
|
||||
return err;
|
||||
}
|
||||
@@ -271,8 +273,9 @@ mext_out:
|
||||
struct super_block *sb = inode->i_sb;
|
||||
int err, err2=0;
|
||||
|
||||
if (!capable(CAP_SYS_RESOURCE))
|
||||
return -EPERM;
|
||||
err = ext4_resize_begin(sb);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (copy_from_user(&input, (struct ext4_new_group_input __user *)arg,
|
||||
sizeof(input)))
|
||||
@@ -291,6 +294,7 @@ mext_out:
|
||||
if (err == 0)
|
||||
err = err2;
|
||||
mnt_drop_write(filp->f_path.mnt);
|
||||
ext4_resize_end(sb);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
Reference in New Issue
Block a user