Re: [PATCH] staging: exfat: use bdev_sync function directly where needed

From: Valdis KlÄtnieks
Date: Wed Oct 02 2019 - 15:04:28 EST


On Wed, 02 Oct 2019 20:47:03 +0530, Saiyam Doshi said:
> fs_sync() is wrapper to bdev_sync(). When fs_sync is called with
> non-zero argument, bdev_sync gets called.
>
> Most instances of fs_sync is called with false and very few with
> true. Refactor this and makes direct call to bdev_sync() where
> needed and removes fs_sync definition.

Did you do an actual analysis of where bdev_sync() *should*
be called?

The note in the TODO was intended to point out that many of the calls
are called with 'false' and probably should not be.

#ifdef CONFIG_EXFAT_DELAYED_SYNC
- fs_sync(sb, false);
fs_set_vol_flags(sb, VOL_CLEAN);
#endif

Consider - with this patch, we are now setting the volume state to clean - but
we've not actually flushed the filesystem to disk, which means it's almost
guaranteed that the file system is *NOT* in fact clean.

Changing all the 'false' that happen before a VOL_CLEAN to 'true' is
probably more correct - but still totally wrong if DELAYED_SYNC isn't defined
because then we *aren't* syncing to disk at all.


Attachment: pgpP9UQ8gaLF1.pgp
Description: PGP signature