* [PATCH] f2fs: fix error handling on device alias check in rename and unlink
@ 2026-08-21 14:17 Daeho Jeong
2026-08-21 15:26 ` [f2fs-dev] " Jaegeuk Kim
2026-08-21 15:50 ` patchwork-bot+f2fs
0 siblings, 2 replies; 7+ messages in thread
From: Daeho Jeong @ 2026-08-21 14:17 UTC (permalink / raw)
To: linux-kernel, linux-f2fs-devel, kernel-team
Cc: Daeho Jeong, stable, Christophe JAILLET, Chao Yu
From: Daeho Jeong <daehojeong@google.com>
In f2fs_rename() and f2fs_unlink(), directly returning -EPERM when
encountering a device aliasing file bypasses the cleanup path.
Fix this by setting err to -EPERM and jumping to the proper cleanup
labels (out_dir and out) instead of returning immediately.
Fixes: a737e409a3d6 ("f2fs: support dynamic reserve/release for device aliasing")
Cc: stable@kernel.org
Reported-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Daeho Jeong <daehojeong@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
---
fs/f2fs/namei.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index 784f636244e1..b9b15c5d28de 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -571,8 +571,10 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry)
trace_f2fs_unlink_enter(dir, dentry);
- if (IS_DEVICE_ALIASING(inode))
- return -EPERM;
+ if (IS_DEVICE_ALIASING(inode)) {
+ err = -EPERM;
+ goto out;
+ }
if (unlikely(f2fs_cp_error(sbi))) {
err = -EIO;
@@ -1025,8 +1027,10 @@ static int f2fs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
}
if (new_inode) {
- if (IS_DEVICE_ALIASING(new_inode))
- return -EPERM;
+ if (IS_DEVICE_ALIASING(new_inode)) {
+ err = -EPERM;
+ goto out_dir;
+ }
err = -ENOTEMPTY;
if (old_is_dir && !f2fs_empty_dir(new_inode))
--
2.55.0.766.g2966f0265a-goog
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [f2fs-dev] [PATCH] f2fs: fix error handling on device alias check in rename and unlink
2026-08-21 14:17 [PATCH] f2fs: fix error handling on device alias check in rename and unlink Daeho Jeong
@ 2026-08-21 15:26 ` Jaegeuk Kim
2026-08-21 23:48 ` Chao Yu
2026-08-21 15:50 ` patchwork-bot+f2fs
1 sibling, 1 reply; 7+ messages in thread
From: Jaegeuk Kim @ 2026-08-21 15:26 UTC (permalink / raw)
To: Daeho Jeong
Cc: linux-kernel, linux-f2fs-devel, kernel-team, Christophe JAILLET,
Daeho Jeong, stable
On 08/21, Daeho Jeong wrote:
> From: Daeho Jeong <daehojeong@google.com>
>
> In f2fs_rename() and f2fs_unlink(), directly returning -EPERM when
> encountering a device aliasing file bypasses the cleanup path.
>
> Fix this by setting err to -EPERM and jumping to the proper cleanup
> labels (out_dir and out) instead of returning immediately.
>
> Fixes: a737e409a3d6 ("f2fs: support dynamic reserve/release for device aliasing")
> Cc: stable@kernel.org
Applied without Fixes and stable, since the original patch has not been
upstreamed.
> Reported-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> Signed-off-by: Daeho Jeong <daehojeong@google.com>
> Reviewed-by: Chao Yu <chao@kernel.org>
> ---
> fs/f2fs/namei.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
> index 784f636244e1..b9b15c5d28de 100644
> --- a/fs/f2fs/namei.c
> +++ b/fs/f2fs/namei.c
> @@ -571,8 +571,10 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry)
>
> trace_f2fs_unlink_enter(dir, dentry);
>
> - if (IS_DEVICE_ALIASING(inode))
> - return -EPERM;
> + if (IS_DEVICE_ALIASING(inode)) {
> + err = -EPERM;
> + goto out;
> + }
>
> if (unlikely(f2fs_cp_error(sbi))) {
> err = -EIO;
> @@ -1025,8 +1027,10 @@ static int f2fs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
> }
>
> if (new_inode) {
> - if (IS_DEVICE_ALIASING(new_inode))
> - return -EPERM;
> + if (IS_DEVICE_ALIASING(new_inode)) {
> + err = -EPERM;
> + goto out_dir;
> + }
>
> err = -ENOTEMPTY;
> if (old_is_dir && !f2fs_empty_dir(new_inode))
> --
> 2.55.0.766.g2966f0265a-goog
>
>
>
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [f2fs-dev] [PATCH] f2fs: fix error handling on device alias check in rename and unlink
2026-08-21 15:26 ` [f2fs-dev] " Jaegeuk Kim
@ 2026-08-21 23:48 ` Chao Yu
2026-08-22 0:12 ` Jaegeuk Kim
0 siblings, 1 reply; 7+ messages in thread
From: Chao Yu @ 2026-08-21 23:48 UTC (permalink / raw)
To: Jaegeuk Kim, Daeho Jeong
Cc: chao, Daeho Jeong, linux-kernel, linux-f2fs-devel,
Christophe JAILLET, kernel-team, stable
On 8/21/26 23:26, Jaegeuk Kim via Linux-f2fs-devel wrote:
> On 08/21, Daeho Jeong wrote:
>> From: Daeho Jeong <daehojeong@google.com>
>>
>> In f2fs_rename() and f2fs_unlink(), directly returning -EPERM when
>> encountering a device aliasing file bypasses the cleanup path.
>>
>> Fix this by setting err to -EPERM and jumping to the proper cleanup
>> labels (out_dir and out) instead of returning immediately.
>>
>> Fixes: a737e409a3d6 ("f2fs: support dynamic reserve/release for device aliasing")
>> Cc: stable@kernel.org
>
> Applied without Fixes and stable, since the original patch has not been
> upstreamed.
Jaegeuk, if we don't plan to merge them, we'd better keep the Fixes and stable
line, otherwise, once the two patches be upstreamed, we may missed to backport
the fix one due to the missing lines?
Thanks,
>
>> Reported-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>> Signed-off-by: Daeho Jeong <daehojeong@google.com>
>> Reviewed-by: Chao Yu <chao@kernel.org>
>> ---
>> fs/f2fs/namei.c | 12 ++++++++----
>> 1 file changed, 8 insertions(+), 4 deletions(-)
>>
>> diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
>> index 784f636244e1..b9b15c5d28de 100644
>> --- a/fs/f2fs/namei.c
>> +++ b/fs/f2fs/namei.c
>> @@ -571,8 +571,10 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry)
>>
>> trace_f2fs_unlink_enter(dir, dentry);
>>
>> - if (IS_DEVICE_ALIASING(inode))
>> - return -EPERM;
>> + if (IS_DEVICE_ALIASING(inode)) {
>> + err = -EPERM;
>> + goto out;
>> + }
>>
>> if (unlikely(f2fs_cp_error(sbi))) {
>> err = -EIO;
>> @@ -1025,8 +1027,10 @@ static int f2fs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
>> }
>>
>> if (new_inode) {
>> - if (IS_DEVICE_ALIASING(new_inode))
>> - return -EPERM;
>> + if (IS_DEVICE_ALIASING(new_inode)) {
>> + err = -EPERM;
>> + goto out_dir;
>> + }
>>
>> err = -ENOTEMPTY;
>> if (old_is_dir && !f2fs_empty_dir(new_inode))
>> --
>> 2.55.0.766.g2966f0265a-goog
>>
>>
>>
>> _______________________________________________
>> Linux-f2fs-devel mailing list
>> Linux-f2fs-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
>
>
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [f2fs-dev] [PATCH] f2fs: fix error handling on device alias check in rename and unlink
2026-08-21 23:48 ` Chao Yu
@ 2026-08-22 0:12 ` Jaegeuk Kim
2026-08-22 7:10 ` Chao Yu
0 siblings, 1 reply; 7+ messages in thread
From: Jaegeuk Kim @ 2026-08-22 0:12 UTC (permalink / raw)
To: Chao Yu
Cc: Daeho Jeong, Daeho Jeong, linux-kernel, linux-f2fs-devel,
Christophe JAILLET, kernel-team, stable
On 08/22, Chao Yu wrote:
> On 8/21/26 23:26, Jaegeuk Kim via Linux-f2fs-devel wrote:
> > On 08/21, Daeho Jeong wrote:
> > > From: Daeho Jeong <daehojeong@google.com>
> > >
> > > In f2fs_rename() and f2fs_unlink(), directly returning -EPERM when
> > > encountering a device aliasing file bypasses the cleanup path.
> > >
> > > Fix this by setting err to -EPERM and jumping to the proper cleanup
> > > labels (out_dir and out) instead of returning immediately.
> > >
> > > Fixes: a737e409a3d6 ("f2fs: support dynamic reserve/release for device aliasing")
> > > Cc: stable@kernel.org
> >
> > Applied without Fixes and stable, since the original patch has not been
> > upstreamed.
>
> Jaegeuk, if we don't plan to merge them, we'd better keep the Fixes and stable
> line, otherwise, once the two patches be upstreamed, we may missed to backport
> the fix one due to the missing lines?
My concern is the never existing hash in upstream. And, I don't think this will
go into any LTS.
>
> Thanks,
>
> >
> > > Reported-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> > > Signed-off-by: Daeho Jeong <daehojeong@google.com>
> > > Reviewed-by: Chao Yu <chao@kernel.org>
> > > ---
> > > fs/f2fs/namei.c | 12 ++++++++----
> > > 1 file changed, 8 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
> > > index 784f636244e1..b9b15c5d28de 100644
> > > --- a/fs/f2fs/namei.c
> > > +++ b/fs/f2fs/namei.c
> > > @@ -571,8 +571,10 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry)
> > > trace_f2fs_unlink_enter(dir, dentry);
> > > - if (IS_DEVICE_ALIASING(inode))
> > > - return -EPERM;
> > > + if (IS_DEVICE_ALIASING(inode)) {
> > > + err = -EPERM;
> > > + goto out;
> > > + }
> > > if (unlikely(f2fs_cp_error(sbi))) {
> > > err = -EIO;
> > > @@ -1025,8 +1027,10 @@ static int f2fs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
> > > }
> > > if (new_inode) {
> > > - if (IS_DEVICE_ALIASING(new_inode))
> > > - return -EPERM;
> > > + if (IS_DEVICE_ALIASING(new_inode)) {
> > > + err = -EPERM;
> > > + goto out_dir;
> > > + }
> > > err = -ENOTEMPTY;
> > > if (old_is_dir && !f2fs_empty_dir(new_inode))
> > > --
> > > 2.55.0.766.g2966f0265a-goog
> > >
> > >
> > >
> > > _______________________________________________
> > > Linux-f2fs-devel mailing list
> > > Linux-f2fs-devel@lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
> >
> >
> > _______________________________________________
> > Linux-f2fs-devel mailing list
> > Linux-f2fs-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
>
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [f2fs-dev] [PATCH] f2fs: fix error handling on device alias check in rename and unlink
2026-08-22 0:12 ` Jaegeuk Kim
@ 2026-08-22 7:10 ` Chao Yu
0 siblings, 0 replies; 7+ messages in thread
From: Chao Yu @ 2026-08-22 7:10 UTC (permalink / raw)
To: Jaegeuk Kim
Cc: chao, Daeho Jeong, Daeho Jeong, linux-kernel, linux-f2fs-devel,
Christophe JAILLET, kernel-team, stable
On 8/22/26 08:12, Jaegeuk Kim wrote:
> On 08/22, Chao Yu wrote:
>> On 8/21/26 23:26, Jaegeuk Kim via Linux-f2fs-devel wrote:
>>> On 08/21, Daeho Jeong wrote:
>>>> From: Daeho Jeong <daehojeong@google.com>
>>>>
>>>> In f2fs_rename() and f2fs_unlink(), directly returning -EPERM when
>>>> encountering a device aliasing file bypasses the cleanup path.
>>>>
>>>> Fix this by setting err to -EPERM and jumping to the proper cleanup
>>>> labels (out_dir and out) instead of returning immediately.
>>>>
>>>> Fixes: a737e409a3d6 ("f2fs: support dynamic reserve/release for device aliasing")
>>>> Cc: stable@kernel.org
>>>
>>> Applied without Fixes and stable, since the original patch has not been
>>> upstreamed.
>>
>> Jaegeuk, if we don't plan to merge them, we'd better keep the Fixes and stable
>> line, otherwise, once the two patches be upstreamed, we may missed to backport
>> the fix one due to the missing lines?
>
> My concern is the never existing hash in upstream. And, I don't think this will
> go into any LTS.
Oh, I see, actually, my concern is developers may potentially miss this fix when
backporting related feature.
Thanks,
>
>>
>> Thanks,
>>
>>>
>>>> Reported-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>>>> Signed-off-by: Daeho Jeong <daehojeong@google.com>
>>>> Reviewed-by: Chao Yu <chao@kernel.org>
>>>> ---
>>>> fs/f2fs/namei.c | 12 ++++++++----
>>>> 1 file changed, 8 insertions(+), 4 deletions(-)
>>>>
>>>> diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
>>>> index 784f636244e1..b9b15c5d28de 100644
>>>> --- a/fs/f2fs/namei.c
>>>> +++ b/fs/f2fs/namei.c
>>>> @@ -571,8 +571,10 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry)
>>>> trace_f2fs_unlink_enter(dir, dentry);
>>>> - if (IS_DEVICE_ALIASING(inode))
>>>> - return -EPERM;
>>>> + if (IS_DEVICE_ALIASING(inode)) {
>>>> + err = -EPERM;
>>>> + goto out;
>>>> + }
>>>> if (unlikely(f2fs_cp_error(sbi))) {
>>>> err = -EIO;
>>>> @@ -1025,8 +1027,10 @@ static int f2fs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
>>>> }
>>>> if (new_inode) {
>>>> - if (IS_DEVICE_ALIASING(new_inode))
>>>> - return -EPERM;
>>>> + if (IS_DEVICE_ALIASING(new_inode)) {
>>>> + err = -EPERM;
>>>> + goto out_dir;
>>>> + }
>>>> err = -ENOTEMPTY;
>>>> if (old_is_dir && !f2fs_empty_dir(new_inode))
>>>> --
>>>> 2.55.0.766.g2966f0265a-goog
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Linux-f2fs-devel mailing list
>>>> Linux-f2fs-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
>>>
>>>
>>> _______________________________________________
>>> Linux-f2fs-devel mailing list
>>> Linux-f2fs-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
>>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs: fix error handling on device alias check in rename and unlink
2026-08-21 14:17 [PATCH] f2fs: fix error handling on device alias check in rename and unlink Daeho Jeong
2026-08-21 15:26 ` [f2fs-dev] " Jaegeuk Kim
@ 2026-08-21 15:50 ` patchwork-bot+f2fs
1 sibling, 0 replies; 7+ messages in thread
From: patchwork-bot+f2fs @ 2026-08-21 15:50 UTC (permalink / raw)
To: Daeho Jeong
Cc: linux-kernel, linux-f2fs-devel, kernel-team, christophe.jaillet,
daehojeong, stable
Hello:
This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <jaegeuk@kernel.org>:
On Fri, 21 Aug 2026 07:17:42 -0700 you wrote:
> From: Daeho Jeong <daehojeong@google.com>
>
> In f2fs_rename() and f2fs_unlink(), directly returning -EPERM when
> encountering a device aliasing file bypasses the cleanup path.
>
> Fix this by setting err to -EPERM and jumping to the proper cleanup
> labels (out_dir and out) instead of returning immediately.
>
> [...]
Here is the summary with links:
- [f2fs-dev] f2fs: fix error handling on device alias check in rename and unlink
https://git.kernel.org/jaegeuk/f2fs/c/27d0e27c096d
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] f2fs: fix error handling on device alias check in rename and unlink
@ 2026-08-21 1:18 Daeho Jeong
2026-08-21 1:31 ` [f2fs-dev] " Chao Yu
0 siblings, 1 reply; 7+ messages in thread
From: Daeho Jeong @ 2026-08-21 1:18 UTC (permalink / raw)
To: linux-kernel, linux-f2fs-devel, kernel-team; +Cc: Daeho Jeong, stable
From: Daeho Jeong <daehojeong@google.com>
In f2fs_rename() and f2fs_unlink(), directly returning -EPERM when
encountering a device aliasing file bypasses the cleanup path.
Fix this by setting err to -EPERM and jumping to the proper cleanup
labels (out_dir and out) instead of returning immediately.
Fixes: a737e409a3d6 ("f2fs: support dynamic reserve/release for device aliasing")
Cc: stable@kernel.org
Signed-off-by: Daeho Jeong <daehojeong@google.com>
---
fs/f2fs/namei.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index 784f636244e1..b9b15c5d28de 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -571,8 +571,10 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry)
trace_f2fs_unlink_enter(dir, dentry);
- if (IS_DEVICE_ALIASING(inode))
- return -EPERM;
+ if (IS_DEVICE_ALIASING(inode)) {
+ err = -EPERM;
+ goto out;
+ }
if (unlikely(f2fs_cp_error(sbi))) {
err = -EIO;
@@ -1025,8 +1027,10 @@ static int f2fs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
}
if (new_inode) {
- if (IS_DEVICE_ALIASING(new_inode))
- return -EPERM;
+ if (IS_DEVICE_ALIASING(new_inode)) {
+ err = -EPERM;
+ goto out_dir;
+ }
err = -ENOTEMPTY;
if (old_is_dir && !f2fs_empty_dir(new_inode))
--
2.55.0.766.g2966f0265a-goog
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [f2fs-dev] [PATCH] f2fs: fix error handling on device alias check in rename and unlink
2026-08-21 1:18 Daeho Jeong
@ 2026-08-21 1:31 ` Chao Yu
0 siblings, 0 replies; 7+ messages in thread
From: Chao Yu @ 2026-08-21 1:31 UTC (permalink / raw)
To: Daeho Jeong, linux-kernel, linux-f2fs-devel, kernel-team
Cc: chao, Daeho Jeong, stable
On 8/21/26 09:18, Daeho Jeong wrote:
> From: Daeho Jeong <daehojeong@google.com>
>
> In f2fs_rename() and f2fs_unlink(), directly returning -EPERM when
> encountering a device aliasing file bypasses the cleanup path.
>
> Fix this by setting err to -EPERM and jumping to the proper cleanup
> labels (out_dir and out) instead of returning immediately.
>
> Fixes: a737e409a3d6 ("f2fs: support dynamic reserve/release for device aliasing")
> Cc: stable@kernel.org
> Signed-off-by: Daeho Jeong <daehojeong@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Thanks,
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-08-22 7:10 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-21 14:17 [PATCH] f2fs: fix error handling on device alias check in rename and unlink Daeho Jeong
2026-08-21 15:26 ` [f2fs-dev] " Jaegeuk Kim
2026-08-21 23:48 ` Chao Yu
2026-08-22 0:12 ` Jaegeuk Kim
2026-08-22 7:10 ` Chao Yu
2026-08-21 15:50 ` patchwork-bot+f2fs
-- strict thread matches above, loose matches on Subject: below --
2026-08-21 1:18 Daeho Jeong
2026-08-21 1:31 ` [f2fs-dev] " Chao Yu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox