Commit 9f09deec authored by Dongliang Cui's avatar Dongliang Cui Committed by John Stultz
Browse files

BACKPORT: exfat: Implement sops->shutdown and ioctl



We found that when writing a large file through buffer write, if the
disk is inaccessible, exFAT does not return an error normally, which
leads to the writing process not stopping properly.

To easily reproduce this issue, you can follow the steps below:

1. format a device to exFAT and then mount (with a full disk erase)
2. dd if=/dev/zero of=/exfat_mount/test.img bs=1M count=8192
3. eject the device

You may find that the dd process does not stop immediately and may
continue for a long time.

The root cause of this issue is that during buffer write process,
exFAT does not need to access the disk to look up directory entries
or the FAT table (whereas FAT would do) every time data is written.
Instead, exFAT simply marks the buffer as dirty and returns,
delegating the writeback operation to the writeback process.

If the disk cannot be accessed at this time, the error will only be
returned to the writeback process, and the original process will not
receive the error, so it cannot be returned to the user side.

When the disk cannot be accessed normally, an error should be returned
to stop the writing process.

Implement sops->shutdown and ioctl to shut down the file system
when underlying block device is marked dead.

Signed-off-by: default avatarDongliang Cui <dongliang.cui@unisoc.com>
Signed-off-by: default avatarZhiguo Niu <zhiguo.niu@unisoc.com>
Signed-off-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
(cherry picked from commit f761fcdd)

[dongliang.cui: There is an issue here, as the shutdown is not
 implemented on k515, the patch needs to be adapted for k515.
 Therefore, we have referred to the block_device_ejected of ext4
 to achieve the same purpose.]

Change-Id: Ie3b6b5171c29b38c5f7a9415e8671fc82abf9c09
Signed-off-by: default avatardongliang.cui <dongliang.cui@unisoc.com>
parent 62bbb08a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment