linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] exfat: use updated exfat_chain directly during renaming
       [not found] <CGME20220608020502epcas1p14911cac6731ee98fcb9c64282455caf7@epcas1p1.samsung.com>
@ 2022-06-08  2:04 ` Sungjong Seo
  2022-06-09 12:35   ` Namjae Jeon
  2022-09-30  9:00   ` Pavel Reichl
  0 siblings, 2 replies; 5+ messages in thread
From: Sungjong Seo @ 2022-06-08  2:04 UTC (permalink / raw)
  To: linkinjeon; +Cc: sj1557.seo, linux-fsdevel, linux-kernel

In order for a file to access its own directory entry set,
exfat_inode_info(ei) has two copied values. One is ei->dir, which is
a snapshot of exfat_chain of the parent directory, and the other is
ei->entry, which is the offset of the start of the directory entry set
in the parent directory.

Since the parent directory can be updated after the snapshot point,
it should be used only for accessing one's own directory entry set.

However, as of now, during renaming, it could try to traverse or to
allocate clusters via snapshot values, it does not make sense.

This potential problem has been revealed when exfat_update_parent_info()
was removed by commit d8dad2588add ("exfat: fix referencing wrong parent
directory information after renaming"). However, I don't think it's good
idea to bring exfat_update_parent_info() back.

Instead, let's use the updated exfat_chain of parent directory diectly.

Fixes: d8dad2588add ("exfat: fix referencing wrong parent directory information after renaming")

Signed-off-by: Sungjong Seo <sj1557.seo@samsung.com>
---
 fs/exfat/namei.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/exfat/namei.c b/fs/exfat/namei.c
index 76acc3721951..c6eaf7e9ea74 100644
--- a/fs/exfat/namei.c
+++ b/fs/exfat/namei.c
@@ -1198,7 +1198,9 @@ static int __exfat_rename(struct inode *old_parent_inode,
 		return -ENOENT;
 	}
 
-	exfat_chain_dup(&olddir, &ei->dir);
+	exfat_chain_set(&olddir, EXFAT_I(old_parent_inode)->start_clu,
+		EXFAT_B_TO_CLU_ROUND_UP(i_size_read(old_parent_inode), sbi),
+		EXFAT_I(old_parent_inode)->flags);
 	dentry = ei->entry;
 
 	ep = exfat_get_dentry(sb, &olddir, dentry, &old_bh);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] exfat: use updated exfat_chain directly during renaming
  2022-06-08  2:04 ` [PATCH] exfat: use updated exfat_chain directly during renaming Sungjong Seo
@ 2022-06-09 12:35   ` Namjae Jeon
  2022-09-30  9:00   ` Pavel Reichl
  1 sibling, 0 replies; 5+ messages in thread
From: Namjae Jeon @ 2022-06-09 12:35 UTC (permalink / raw)
  To: Sungjong Seo; +Cc: linux-fsdevel, linux-kernel

2022-06-08 11:04 GMT+09:00, Sungjong Seo <sj1557.seo@samsung.com>:
> In order for a file to access its own directory entry set,
> exfat_inode_info(ei) has two copied values. One is ei->dir, which is
> a snapshot of exfat_chain of the parent directory, and the other is
> ei->entry, which is the offset of the start of the directory entry set
> in the parent directory.
>
> Since the parent directory can be updated after the snapshot point,
> it should be used only for accessing one's own directory entry set.
>
> However, as of now, during renaming, it could try to traverse or to
> allocate clusters via snapshot values, it does not make sense.
>
> This potential problem has been revealed when exfat_update_parent_info()
> was removed by commit d8dad2588add ("exfat: fix referencing wrong parent
> directory information after renaming"). However, I don't think it's good
> idea to bring exfat_update_parent_info() back.
>
> Instead, let's use the updated exfat_chain of parent directory diectly.
>
> Fixes: d8dad2588add ("exfat: fix referencing wrong parent directory
> information after renaming")
>
> Signed-off-by: Sungjong Seo <sj1557.seo@samsung.com>
Applied, Thanks for your patch!

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] exfat: use updated exfat_chain directly during renaming
  2022-06-08  2:04 ` [PATCH] exfat: use updated exfat_chain directly during renaming Sungjong Seo
  2022-06-09 12:35   ` Namjae Jeon
@ 2022-09-30  9:00   ` Pavel Reichl
  2022-09-30  9:13     ` Namjae Jeon
  1 sibling, 1 reply; 5+ messages in thread
From: Pavel Reichl @ 2022-09-30  9:00 UTC (permalink / raw)
  To: Sungjong Seo, linkinjeon; +Cc: linux-fsdevel, linux-kernel


On 6/8/22 04:04, Sungjong Seo wrote:
>
> Fixes: d8dad2588add ("exfat: fix referencing wrong parent directory information after renaming")

Hello,

I just wonder, since the fixed patch had tag: 'Cc: stable@vger.kernel.org' should this, fixing patch, go to stable as well?

Thanks!


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] exfat: use updated exfat_chain directly during renaming
  2022-09-30  9:00   ` Pavel Reichl
@ 2022-09-30  9:13     ` Namjae Jeon
  2022-09-30 10:03       ` Pavel Reichl
  0 siblings, 1 reply; 5+ messages in thread
From: Namjae Jeon @ 2022-09-30  9:13 UTC (permalink / raw)
  To: Pavel Reichl; +Cc: Sungjong Seo, linux-fsdevel, linux-kernel

2022-09-30 18:00 GMT+09:00, Pavel Reichl <preichl@redhat.com>:
>
> On 6/8/22 04:04, Sungjong Seo wrote:
>>
>> Fixes: d8dad2588add ("exfat: fix referencing wrong parent directory
>> information after renaming")
>
> Hello,
>
> I just wonder, since the fixed patch had tag: 'Cc: stable@vger.kernel.org'
> should this, fixing patch, go to stable as well?
It was well applied into stable kernels although stable tag was missing.
>
> Thanks!
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] exfat: use updated exfat_chain directly during renaming
  2022-09-30  9:13     ` Namjae Jeon
@ 2022-09-30 10:03       ` Pavel Reichl
  0 siblings, 0 replies; 5+ messages in thread
From: Pavel Reichl @ 2022-09-30 10:03 UTC (permalink / raw)
  To: Namjae Jeon; +Cc: Sungjong Seo, linux-fsdevel, linux-kernel


On 9/30/22 11:13, Namjae Jeon wrote:
> 2022-09-30 18:00 GMT+09:00, Pavel Reichl <preichl@redhat.com>:
>> On 6/8/22 04:04, Sungjong Seo wrote:
>>> Fixes: d8dad2588add ("exfat: fix referencing wrong parent directory
>>> information after renaming")
>> Hello,
>>
>> I just wonder, since the fixed patch had tag: 'Cc: stable@vger.kernel.org'
>> should this, fixing patch, go to stable as well?
> It was well applied into stable kernels although stable tag was missing.
Oh, OK, thank you!
>> Thanks!
>>
>>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-09-30 10:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20220608020502epcas1p14911cac6731ee98fcb9c64282455caf7@epcas1p1.samsung.com>
2022-06-08  2:04 ` [PATCH] exfat: use updated exfat_chain directly during renaming Sungjong Seo
2022-06-09 12:35   ` Namjae Jeon
2022-09-30  9:00   ` Pavel Reichl
2022-09-30  9:13     ` Namjae Jeon
2022-09-30 10:03       ` Pavel Reichl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).