-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
exfat: Implement sops->shutdown and ioctl
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)
- Loading branch information
Showing
6 changed files
with
121 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | ||
/* | ||
* Copyright (C) 2024 Unisoc Technologies Co., Ltd. | ||
*/ | ||
|
||
#ifndef _UAPI_LINUX_EXFAT_H | ||
#define _UAPI_LINUX_EXFAT_H | ||
#include <linux/types.h> | ||
#include <linux/ioctl.h> | ||
|
||
/* | ||
* exfat-specific ioctl commands | ||
*/ | ||
|
||
#define EXFAT_IOC_SHUTDOWN _IOR('X', 125, __u32) | ||
|
||
/* | ||
* Flags used by EXFAT_IOC_SHUTDOWN | ||
*/ | ||
|
||
#define EXFAT_GOING_DOWN_DEFAULT 0x0 /* default with full sync */ | ||
#define EXFAT_GOING_DOWN_FULLSYNC 0x1 /* going down with full sync*/ | ||
#define EXFAT_GOING_DOWN_NOSYNC 0x2 /* going down */ | ||
|
||
#endif /* _UAPI_LINUX_EXFAT_H */ |