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

Configure Feed

Select the types of activity you want to include in your feed.

ext4: split ext4_shutdown

Split ext4_shutdown into a low-level helper that will be reused for
implementing the shutdown super operation and a wrapper for the ioctl
handling.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jan Kara <jack@suse.cz>
Acked-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Link: https://lore.kernel.org/r/20230601094459.1350643-15-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Christoph Hellwig and committed by
Jens Axboe
97524b45 8067ca1d

+16 -9
+1
fs/ext4/ext4.h
··· 2965 2965 int ext4_fileattr_get(struct dentry *dentry, struct fileattr *fa); 2966 2966 extern void ext4_reset_inode_seed(struct inode *inode); 2967 2967 int ext4_update_overhead(struct super_block *sb, bool force); 2968 + int ext4_force_shutdown(struct super_block *sb, u32 flags); 2968 2969 2969 2970 /* migrate.c */ 2970 2971 extern int ext4_ext_migrate(struct inode *);
+15 -9
fs/ext4/ioctl.c
··· 793 793 } 794 794 #endif 795 795 796 - static int ext4_shutdown(struct super_block *sb, unsigned long arg) 796 + int ext4_force_shutdown(struct super_block *sb, u32 flags) 797 797 { 798 798 struct ext4_sb_info *sbi = EXT4_SB(sb); 799 - __u32 flags; 800 - 801 - if (!capable(CAP_SYS_ADMIN)) 802 - return -EPERM; 803 - 804 - if (get_user(flags, (__u32 __user *)arg)) 805 - return -EFAULT; 806 799 807 800 if (flags > EXT4_GOING_FLAGS_NOLOGFLUSH) 808 801 return -EINVAL; ··· 829 836 } 830 837 clear_opt(sb, DISCARD); 831 838 return 0; 839 + } 840 + 841 + static int ext4_ioctl_shutdown(struct super_block *sb, unsigned long arg) 842 + { 843 + u32 flags; 844 + 845 + if (!capable(CAP_SYS_ADMIN)) 846 + return -EPERM; 847 + 848 + if (get_user(flags, (__u32 __user *)arg)) 849 + return -EFAULT; 850 + 851 + return ext4_force_shutdown(sb, flags); 832 852 } 833 853 834 854 struct getfsmap_info { ··· 1572 1566 return ext4_ioctl_get_es_cache(filp, arg); 1573 1567 1574 1568 case EXT4_IOC_SHUTDOWN: 1575 - return ext4_shutdown(sb, arg); 1569 + return ext4_ioctl_shutdown(sb, arg); 1576 1570 1577 1571 case FS_IOC_ENABLE_VERITY: 1578 1572 if (!ext4_has_feature_verity(sb))