mbox series

[v8,0/3] ksmbd patches included vfs changes

Message ID 20230315223435.5139-1-linkinjeon@kernel.org (mailing list archive)
Headers show
Series ksmbd patches included vfs changes | expand

Message

Namjae Jeon March 15, 2023, 10:34 p.m. UTC
v8:
  - Don't call vfs_path_lookup() to avoid repeat lookup, Instead, lookup
    last component after locking the parent that got from vfs_path_parent_lookup
    helper.
v7:
  - constify struct path.
  - recreate patch-set base on recent Al's patches.
v6:
  - rename __lookup_hash() to lookup_one_qstr_excl and export.
  - change dget() to dget_parent() in unlink.
  - lock parent of open file in smb2_open() to make file_present
    worthable.
v5:
  - add lock_rename_child() helper.
  - remove d_is_symlink() check for new_path.dentry.
  - use lock_rename_child() helper instead of lock_rename().
  - use dget() instead of dget_parent().
  - check that old_child is still hashed.
  - directly check child->parent instead of using take_dentry_name_snapshot().
v4:
   - switch the order of 3/4 and 4/4 patch.
   - fix vfs_path_parent_lookup() parameter description mismatch.
v3:
  - use dget_parent + take_dentry_name_snapshot() to check stability of source
    rename in smb2_vfs_rename().
v2:
  - add filename_lock to avoid racy issue from fp->filename. (Sergey Senozhatsky)
  - fix warning: variable 'old_dentry' is used uninitialized (kernel
    test robot)

Al Viro (1):
  fs: introduce lock_rename_child() helper

Namjae Jeon (2):
  ksmbd: remove internal.h include
  ksmbd: fix racy issue from using ->d_parent and ->d_name

 fs/internal.h         |   2 -
 fs/ksmbd/smb2pdu.c    | 147 ++++----------
 fs/ksmbd/vfs.c        | 435 ++++++++++++++++++------------------------
 fs/ksmbd/vfs.h        |  19 +-
 fs/ksmbd/vfs_cache.c  |   5 +-
 fs/namei.c            | 125 +++++++++---
 include/linux/namei.h |   9 +
 7 files changed, 342 insertions(+), 400 deletions(-)

Comments

Al Viro April 21, 2023, 2:35 a.m. UTC | #1
On Thu, Mar 16, 2023 at 07:34:32AM +0900, Namjae Jeon wrote:

OK...  Let's do it that way: I put the first two commits into
never-rebased branch (work.lock_rename_child), then you pull
it into your tree (and slap the third commit on top of that)
while I merge it into #for-next.
Al Viro April 21, 2023, 2:38 a.m. UTC | #2
On Fri, Apr 21, 2023 at 03:35:00AM +0100, Al Viro wrote:
> On Thu, Mar 16, 2023 at 07:34:32AM +0900, Namjae Jeon wrote:
> 
> OK...  Let's do it that way: I put the first two commits into
> never-rebased branch (work.lock_rename_child), then you pull
> it into your tree (and slap the third commit on top of that)
> while I merge it into #for-next.

Done and pushed.
Namjae Jeon April 21, 2023, 7:26 a.m. UTC | #3
2023-04-21 11:35 GMT+09:00, Al Viro <viro@zeniv.linux.org.uk>:
> On Thu, Mar 16, 2023 at 07:34:32AM +0900, Namjae Jeon wrote:
>
> OK...  Let's do it that way: I put the first two commits into
> never-rebased branch (work.lock_rename_child), then you pull
> it into your tree (and slap the third commit on top of that)
> while I merge it into #for-next.
Okay. Can I add your acked-by in third patch ?

Thank you!
>
Amir Goldstein June 13, 2023, 10:57 a.m. UTC | #4
Hi Namjae,

Maybe I am missing something, but I do not see any mnt_want_write()
in ksmbd at all. Is it well hidden somewhere?

Thanks,
Amir.

On Thu, Mar 16, 2023 at 12:37 AM Namjae Jeon <linkinjeon@kernel.org> wrote:
>
> v8:
>   - Don't call vfs_path_lookup() to avoid repeat lookup, Instead, lookup
>     last component after locking the parent that got from vfs_path_parent_lookup
>     helper.
> v7:
>   - constify struct path.
>   - recreate patch-set base on recent Al's patches.
> v6:
>   - rename __lookup_hash() to lookup_one_qstr_excl and export.
>   - change dget() to dget_parent() in unlink.
>   - lock parent of open file in smb2_open() to make file_present
>     worthable.
> v5:
>   - add lock_rename_child() helper.
>   - remove d_is_symlink() check for new_path.dentry.
>   - use lock_rename_child() helper instead of lock_rename().
>   - use dget() instead of dget_parent().
>   - check that old_child is still hashed.
>   - directly check child->parent instead of using take_dentry_name_snapshot().
> v4:
>    - switch the order of 3/4 and 4/4 patch.
>    - fix vfs_path_parent_lookup() parameter description mismatch.
> v3:
>   - use dget_parent + take_dentry_name_snapshot() to check stability of source
>     rename in smb2_vfs_rename().
> v2:
>   - add filename_lock to avoid racy issue from fp->filename. (Sergey Senozhatsky)
>   - fix warning: variable 'old_dentry' is used uninitialized (kernel
>     test robot)
>
> Al Viro (1):
>   fs: introduce lock_rename_child() helper
>
> Namjae Jeon (2):
>   ksmbd: remove internal.h include
>   ksmbd: fix racy issue from using ->d_parent and ->d_name
>
>  fs/internal.h         |   2 -
>  fs/ksmbd/smb2pdu.c    | 147 ++++----------
>  fs/ksmbd/vfs.c        | 435 ++++++++++++++++++------------------------
>  fs/ksmbd/vfs.h        |  19 +-
>  fs/ksmbd/vfs_cache.c  |   5 +-
>  fs/namei.c            | 125 +++++++++---
>  include/linux/namei.h |   9 +
>  7 files changed, 342 insertions(+), 400 deletions(-)
>
> --
> 2.25.1
>
Namjae Jeon June 13, 2023, 12:24 p.m. UTC | #5
2023-06-13 19:57 GMT+09:00, Amir Goldstein <amir73il@gmail.com>:
> Hi Namjae,
Hi Amir,
>
> Maybe I am missing something, but I do not see any mnt_want_write()
> in ksmbd at all. Is it well hidden somewhere?
At a quick glance, We need to add it for ksmbd_vfs_unlink and ksmbd_vfs_rename.
I'll look further into where else should I add it.

Thanks for letting me know!
>
> Thanks,
> Amir.
>
> On Thu, Mar 16, 2023 at 12:37 AM Namjae Jeon <linkinjeon@kernel.org> wrote:
>>
>> v8:
>>   - Don't call vfs_path_lookup() to avoid repeat lookup, Instead, lookup
>>     last component after locking the parent that got from
>> vfs_path_parent_lookup
>>     helper.
>> v7:
>>   - constify struct path.
>>   - recreate patch-set base on recent Al's patches.
>> v6:
>>   - rename __lookup_hash() to lookup_one_qstr_excl and export.
>>   - change dget() to dget_parent() in unlink.
>>   - lock parent of open file in smb2_open() to make file_present
>>     worthable.
>> v5:
>>   - add lock_rename_child() helper.
>>   - remove d_is_symlink() check for new_path.dentry.
>>   - use lock_rename_child() helper instead of lock_rename().
>>   - use dget() instead of dget_parent().
>>   - check that old_child is still hashed.
>>   - directly check child->parent instead of using
>> take_dentry_name_snapshot().
>> v4:
>>    - switch the order of 3/4 and 4/4 patch.
>>    - fix vfs_path_parent_lookup() parameter description mismatch.
>> v3:
>>   - use dget_parent + take_dentry_name_snapshot() to check stability of
>> source
>>     rename in smb2_vfs_rename().
>> v2:
>>   - add filename_lock to avoid racy issue from fp->filename. (Sergey
>> Senozhatsky)
>>   - fix warning: variable 'old_dentry' is used uninitialized (kernel
>>     test robot)
>>
>> Al Viro (1):
>>   fs: introduce lock_rename_child() helper
>>
>> Namjae Jeon (2):
>>   ksmbd: remove internal.h include
>>   ksmbd: fix racy issue from using ->d_parent and ->d_name
>>
>>  fs/internal.h         |   2 -
>>  fs/ksmbd/smb2pdu.c    | 147 ++++----------
>>  fs/ksmbd/vfs.c        | 435 ++++++++++++++++++------------------------
>>  fs/ksmbd/vfs.h        |  19 +-
>>  fs/ksmbd/vfs_cache.c  |   5 +-
>>  fs/namei.c            | 125 +++++++++---
>>  include/linux/namei.h |   9 +
>>  7 files changed, 342 insertions(+), 400 deletions(-)
>>
>> --
>> 2.25.1
>>
>