Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Deepin-Kernel-SIG] [linux-6.6.y] [Upstream] exfat: Implement sops->shutdown and ioctl #476

Merged
merged 1 commit into from
Nov 19, 2024

Conversation

opsiff
Copy link
Member

@opsiff opsiff commented Nov 18, 2024

mainline inclusion
from mainline-v6.12-rc1

[ Upstream commit f761fcdd289d07e8547fef7ac76c3760fc7803f2 ]

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: Dongliang Cui [email protected]
Signed-off-by: Zhiguo Niu [email protected]
Signed-off-by: Namjae Jeon [email protected]
(cherry picked from commit f761fcdd289d07e8547fef7ac76c3760fc7803f2)

[dongliang.cui: bdev_freeze & bdev_thaw has a different name in k66
and mainline, make adaptation modifications.
Resolve conflicts in 'fs/exfat/inode.c' and 'fs/exfat/namei.c'.]

Change-Id: Icb7ece39d885cded6d54557c382e84b222f8cada
Signed-off-by: dongliang.cui [email protected]
(cherry picked from commit 3326d8c45d52d83bd6dd57405e99c1f6938ce18f)

mainline inclusion
from mainline-v6.12-rc1

[ Upstream commit f761fcdd289d07e8547fef7ac76c3760fc7803f2 ]

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: Dongliang Cui <[email protected]>
Signed-off-by: Zhiguo Niu <[email protected]>
Signed-off-by: Namjae Jeon <[email protected]>
(cherry picked from commit f761fcdd289d07e8547fef7ac76c3760fc7803f2)

[dongliang.cui: bdev_freeze & bdev_thaw has a different name in k66
 and mainline, make adaptation modifications.
 Resolve conflicts in 'fs/exfat/inode.c' and 'fs/exfat/namei.c'.]

Change-Id: Icb7ece39d885cded6d54557c382e84b222f8cada
Signed-off-by: dongliang.cui <[email protected]>
(cherry picked from commit 3326d8c45d52d83bd6dd57405e99c1f6938ce18f)
@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from opsiff. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@opsiff opsiff changed the title exfat: Implement sops->shutdown and ioctl [Deepin-Kernel-SIG] [linux-6.6.y] [Upstream] exfat: Implement sops->shutdown and ioctl Nov 18, 2024
@opsiff opsiff merged commit d413d86 into linux-6.6.y Nov 19, 2024
5 of 10 checks passed
@opsiff opsiff deleted the exfat-fixes branch November 19, 2024 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants