Skip to contentSkip to conversation

f2fs: fix to avoid move_range and defragment on device_alias file

PATCH Applied Chao Yu 2 participants 2 messages Jun 23 – Aug 5 F2FS file system

lore
Share & tools
lore

Chao Yu

author maintainer
#0 lore raw

PATCH 1/1 f2fs: fix to avoid move_range and defragment on device_alias file

It's forbidden to migrate blocks of device alias file.

Fixes 128d333f0dff ("f2fs: introduce device aliasing file")
---
 fs/f2fs/file.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
fs/f2fs/file.c +5 -1
index 4b52c56d71f0..f4facd409d9b 100644
@@ -3083,6 +3083,9 @@ static int f2fs_ioc_defragment(struct file *filp, unsigned long arg)
 	if (f2fs_readonly(sbi->sb))
 		return -EROFS;
 
+	if (IS_DEVICE_ALIASING(inode))
+		return -EOPNOTSUPP;
+
 	if (copy_from_user(&range, (struct f2fs_defragment __user *)arg,
 							sizeof(range)))
 		return -EFAULT;
@@ -3135,7 +3138,8 @@ static int f2fs_move_file_range(struct file *file_in, loff_t pos_in,
 	if (!S_ISREG(src->i_mode) || !S_ISREG(dst->i_mode))
 		return -EINVAL;
 
-	if (IS_ENCRYPTED(src) || IS_ENCRYPTED(dst))
+	if (IS_ENCRYPTED(src) || IS_ENCRYPTED(dst) ||
+		IS_DEVICE_ALIASING(src) || IS_DEVICE_ALIASING(dst))
 		return -EOPNOTSUPP;
 
 	if (pos_out < 0 || pos_in < 0)
Signature · 1 line
2.49.0
#1 lore raw

Hello:

This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <[email protected]>:

Quoted 8 lines · On Tue, 23 Jun 2026 20:48:23 +0800 you wrote:

It's forbidden to migrate blocks of device alias file.

Fixes 128d333f0dff ("f2fs: introduce device aliasing file")
---
 fs/f2fs/file.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Here is the summary with links:
- [f2fs-dev] f2fs: fix to avoid move_range and defragment on device_alias file

    https://git.kernel.org/jaegeuk/f2fs/c/1b4db09b7f10

You are awesome, thank you!

Signature · 10 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html




_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel