@@ -308,8 +308,8 @@ static int bch2_ioc_goingdown(struct bch_fs *c, u32 __user *arg)
308308 return ret ;
309309}
310310
311- static long __bch2_ioctl_subvolume_create (struct bch_fs * c , struct file * filp ,
312- struct bch_ioctl_subvolume arg )
311+ static long bch2_ioctl_subvolume_create (struct bch_fs * c , struct file * filp ,
312+ struct bch_ioctl_subvolume arg )
313313{
314314 struct inode * dir ;
315315 struct bch_inode_info * inode ;
@@ -406,9 +406,12 @@ static long __bch2_ioctl_subvolume_create(struct bch_fs *c, struct file *filp,
406406 !arg .src_ptr )
407407 snapshot_src .subvol = inode_inum (to_bch_ei (dir )).subvol ;
408408
409+ down_write (& c -> snapshot_create_lock );
409410 inode = __bch2_create (file_mnt_idmap (filp ), to_bch_ei (dir ),
410411 dst_dentry , arg .mode |S_IFDIR ,
411412 0 , snapshot_src , create_flags );
413+ up_write (& c -> snapshot_create_lock );
414+
412415 error = PTR_ERR_OR_ZERO (inode );
413416 if (error )
414417 goto err3 ;
@@ -429,16 +432,6 @@ static long __bch2_ioctl_subvolume_create(struct bch_fs *c, struct file *filp,
429432 return error ;
430433}
431434
432- static long bch2_ioctl_subvolume_create (struct bch_fs * c , struct file * filp ,
433- struct bch_ioctl_subvolume arg )
434- {
435- down_write (& c -> snapshot_create_lock );
436- long ret = __bch2_ioctl_subvolume_create (c , filp , arg );
437- up_write (& c -> snapshot_create_lock );
438-
439- return ret ;
440- }
441-
442435static long bch2_ioctl_subvolume_destroy (struct bch_fs * c , struct file * filp ,
443436 struct bch_ioctl_subvolume arg )
444437{
0 commit comments