Re: [PATCH v4 5/6] btrfs: implement shutdown ioctl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jul 06, 2025 at 01:07:19PM +0930, Qu Wenruo wrote:
> 在 2025/7/5 23:52, David Sterba 写道:
> >> +static int btrfs_emergency_shutdown(struct btrfs_fs_info *fs_info, u32 flags)
> >> +{
> >> +	int ret = 0;
> >> +
> >> +	if (flags >= BTRFS_SHUTDOWN_FLAGS_LAST)
> >> +		return -EINVAL;
> >> +
> >> +	if (btrfs_is_shutdown(fs_info))
> >> +		return 0;
> >> +
> >> +	switch (flags) {
> >> +	case BTRFS_SHUTDOWN_FLAGS_LOGFLUSH:
> >> +	case BTRFS_SHUTDOWN_FLAGS_DEFAULT:
> >> +		ret = freeze_super(fs_info->sb, FREEZE_HOLDER_KERNEL, NULL);
> > 
> > Recently I've looked at scrub blocking filesystem freezing and it does
> > not work because it blocks on the semaphore taken in mnt_want_write,
> > also taken in freeze_super().
> > 
> > I have an idea for fix, basically pause scrub, undo mnt_want_write
> > and then call freeze_super. So we'll need that too for shutdown. Once
> > implemented the fixup would be to use btrfs_freeze_super callback here.
> 
> It may not be that simple.
> 
> freeze_super() itself is doing extra works related to the 
> stage/freeze_owner/etc.
> 
> I'm not sure if it's a good idea to completely skip that part.
> 
> I'd prefer scrub to check the frozen stage, and if it's already in any 
> FREEZE stages, exit early.

I have working prototype for pausing scrub that does not need to exit,
so far I've tested it with fsfreeze in a VM, I still need to test actual
freezing for suspend purposes.




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux