mbox series

[v2,0/2] ceph: fix fscrypt_destroy_keyring use-after-free bug

Message ID 20230606033212.1068823-1-xiubli@redhat.com (mailing list archive)
Headers show
Series ceph: fix fscrypt_destroy_keyring use-after-free bug | expand

Message

Xiubo Li June 6, 2023, 3:32 a.m. UTC
From: Xiubo Li <xiubli@redhat.com>

V2:
- Improve the code by switching to wait_for_completion_killable_timeout()
  when umounting, at the same add one umount_timeout option.
- Improve the inc/dec helpers for metadata/IO cases.


Xiubo Li (2):
  ceph: drop the messages from MDS when unmounting
  ceph: just wait the osd requests' callbacks to finish when unmounting

 fs/ceph/addr.c       | 10 +++++
 fs/ceph/caps.c       |  6 ++-
 fs/ceph/mds_client.c | 14 +++++--
 fs/ceph/mds_client.h | 11 ++++-
 fs/ceph/quota.c      | 14 +++----
 fs/ceph/snap.c       | 10 +++--
 fs/ceph/super.c      | 99 +++++++++++++++++++++++++++++++++++++++++++-
 fs/ceph/super.h      |  7 ++++
 8 files changed, 154 insertions(+), 17 deletions(-)

Comments

Luis Henriques June 6, 2023, 9:53 a.m. UTC | #1
xiubli@redhat.com writes:

> From: Xiubo Li <xiubli@redhat.com>
>
> V2:
> - Improve the code by switching to wait_for_completion_killable_timeout()
>   when umounting, at the same add one umount_timeout option.

Instead of adding yet another (undocumented!) mount option, why not re-use
the already existent 'mount_timeout' instead?  It's already defined and
kept in 'struct ceph_options', and the default value is defined with the
same value you're using, in CEPH_MOUNT_TIMEOUT_DEFAULT.

Cheers,
Xiubo Li June 6, 2023, 12:29 p.m. UTC | #2
On 6/6/23 17:53, Luís Henriques wrote:
> xiubli@redhat.com writes:
>
>> From: Xiubo Li <xiubli@redhat.com>
>>
>> V2:
>> - Improve the code by switching to wait_for_completion_killable_timeout()
>>    when umounting, at the same add one umount_timeout option.
> Instead of adding yet another (undocumented!) mount option, why not re-use
> the already existent 'mount_timeout' instead?  It's already defined and
> kept in 'struct ceph_options', and the default value is defined with the
> same value you're using, in CEPH_MOUNT_TIMEOUT_DEFAULT.

This is for mount purpose. Is that okay to use the in umount case ?

Thanks

- Xiubo

> Cheers,
Luis Henriques June 7, 2023, 9:18 a.m. UTC | #3
Xiubo Li <xiubli@redhat.com> writes:

> On 6/6/23 17:53, Luís Henriques wrote:
>> xiubli@redhat.com writes:
>>
>>> From: Xiubo Li <xiubli@redhat.com>
>>>
>>> V2:
>>> - Improve the code by switching to wait_for_completion_killable_timeout()
>>>    when umounting, at the same add one umount_timeout option.
>> Instead of adding yet another (undocumented!) mount option, why not re-use
>> the already existent 'mount_timeout' instead?  It's already defined and
>> kept in 'struct ceph_options', and the default value is defined with the
>> same value you're using, in CEPH_MOUNT_TIMEOUT_DEFAULT.
>
> This is for mount purpose. Is that okay to use the in umount case ?

Yeah, you're probably right.  It's just that adding yet another knob for a
corner case that probably will never be used and very few people will know
about is never a good thing (IMO).  Anyway, I think that at least this new
mount option needs to be mentioned in 'Documentation/filesystems/ceph.rst'.

Cheers,
Ilya Dryomov June 7, 2023, 10 a.m. UTC | #4
On Wed, Jun 7, 2023 at 11:18 AM Luís Henriques <lhenriques@suse.de> wrote:
>
> Xiubo Li <xiubli@redhat.com> writes:
>
> > On 6/6/23 17:53, Luís Henriques wrote:
> >> xiubli@redhat.com writes:
> >>
> >>> From: Xiubo Li <xiubli@redhat.com>
> >>>
> >>> V2:
> >>> - Improve the code by switching to wait_for_completion_killable_timeout()
> >>>    when umounting, at the same add one umount_timeout option.
> >> Instead of adding yet another (undocumented!) mount option, why not re-use
> >> the already existent 'mount_timeout' instead?  It's already defined and
> >> kept in 'struct ceph_options', and the default value is defined with the
> >> same value you're using, in CEPH_MOUNT_TIMEOUT_DEFAULT.
> >
> > This is for mount purpose. Is that okay to use the in umount case ?
>
> Yeah, you're probably right.  It's just that adding yet another knob for a
> corner case that probably will never be used and very few people will know
> about is never a good thing (IMO).  Anyway, I think that at least this new
> mount option needs to be mentioned in 'Documentation/filesystems/ceph.rst'.

It's OK and in fact preferrable to stick to mount_timeout to avoid new
knobs.  There is even a precedent for this: RBD uses mount_timeout both
when waiting for the latest osdmap (on "rbd map") and when tearing down
a watch (on "rbd unmap").

Thanks,

                Ilya
Xiubo Li June 8, 2023, 2:10 a.m. UTC | #5
On 6/7/23 18:00, Ilya Dryomov wrote:
> On Wed, Jun 7, 2023 at 11:18 AM Luís Henriques <lhenriques@suse.de> wrote:
>> Xiubo Li <xiubli@redhat.com> writes:
>>
>>> On 6/6/23 17:53, Luís Henriques wrote:
>>>> xiubli@redhat.com writes:
>>>>
>>>>> From: Xiubo Li <xiubli@redhat.com>
>>>>>
>>>>> V2:
>>>>> - Improve the code by switching to wait_for_completion_killable_timeout()
>>>>>     when umounting, at the same add one umount_timeout option.
>>>> Instead of adding yet another (undocumented!) mount option, why not re-use
>>>> the already existent 'mount_timeout' instead?  It's already defined and
>>>> kept in 'struct ceph_options', and the default value is defined with the
>>>> same value you're using, in CEPH_MOUNT_TIMEOUT_DEFAULT.
>>> This is for mount purpose. Is that okay to use the in umount case ?
>> Yeah, you're probably right.  It's just that adding yet another knob for a
>> corner case that probably will never be used and very few people will know
>> about is never a good thing (IMO).  Anyway, I think that at least this new
>> mount option needs to be mentioned in 'Documentation/filesystems/ceph.rst'.
> It's OK and in fact preferrable to stick to mount_timeout to avoid new
> knobs.  There is even a precedent for this: RBD uses mount_timeout both
> when waiting for the latest osdmap (on "rbd map") and when tearing down
> a watch (on "rbd unmap").

If so let's reuse the 'mount_timeout' here.

Thanks

- Xiubo

> Thanks,
>
>                  Ilya
>