linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Use exclusive lock for file_remove_privs
@ 2023-08-31 11:24 Bernd Schubert
  2023-08-31 11:24 ` [PATCH 1/2] fs: Add and export file_needs_remove_privs Bernd Schubert
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Bernd Schubert @ 2023-08-31 11:24 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: bernd.schubert, miklos, dsingh, Bernd Schubert, Josef Bacik,
	linux-btrfs, Alexander Viro, Christian Brauner

While adding shared direct IO write locks to fuse Miklos noticed
that file_remove_privs() needs an exclusive lock. I then
noticed that btrfs actually has the same issue as I had in my patch,
it was calling into that function with a shared lock.
This series adds a new exported function file_needs_remove_privs(),
which used by the follow up btrfs patch and will be used by the
DIO code path in fuse as well. If that function returns any mask
the shared lock needs to be dropped and replaced by the exclusive
variant.

Note: Compilation tested only.

v2:
Already check for IS_NOSEC in btrfs_direct_write before the first
lock is taken.
Slight modification to make the code easier to read (boolean pointer
is passed to btrfs_write_check, instead of flags).

Cc: Miklos Szeredi <miklos@szeredi.hu>
Cc: Dharmendra Singh <dsingh@ddn.com>
Cc: Josef Bacik <josef@toxicpanda.com>
Cc: linux-btrfs@vger.kernel.org
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Christian Brauner <brauner@kernel.org>
Cc: linux-fsdevel@vger.kernel.org


Bernd Schubert (2):
  fs: Add and export file_needs_remove_privs
  btrfs: file_remove_privs needs an exclusive lock

 fs/btrfs/file.c    | 37 +++++++++++++++++++++++++++++--------
 fs/inode.c         |  8 ++++++++
 include/linux/fs.h |  1 +
 3 files changed, 38 insertions(+), 8 deletions(-)

-- 
2.39.2


^ permalink raw reply	[flat|nested] 14+ messages in thread
* [PATCH 0/2] Use exclusive lock for file_remove_privs
@ 2023-08-30 18:15 Bernd Schubert
  2023-08-30 18:15 ` [PATCH 1/2] fs: Add and export file_needs_remove_privs Bernd Schubert
  0 siblings, 1 reply; 14+ messages in thread
From: Bernd Schubert @ 2023-08-30 18:15 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: bernd.schubert, miklos, dsingh, Bernd Schubert, Josef Bacik,
	linux-btrfs, Alexander Viro, Christian Brauner

While adding shared direct IO write locks to fuse Miklos noticed
that file_remove_privs() needs an exclusive lock. I then
noticed that btrfs actually has the same issue as I had in my patch,
it was calling into that function with a shared lock.
This series adds a new exported function file_needs_remove_privs(),
which used by the follow up btrfs patch and will be used by the
DIO code path in fuse as well. If that function returns any mask
the shared lock needs to be dropped and replaced by the exclusive
variant.

Note: Compilation tested only.

Cc: Miklos Szeredi <miklos@szeredi.hu>
Cc: Dharmendra Singh <dsingh@ddn.com>
Cc: Josef Bacik <josef@toxicpanda.com>
Cc: linux-btrfs@vger.kernel.org
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Christian Brauner <brauner@kernel.org>
Cc: linux-fsdevel@vger.kernel.org


Bernd Schubert (2):
  fs: Add and export file_needs_remove_privs
  btrfs: file_remove_privs needs an exclusive lock

 fs/btrfs/file.c    | 37 +++++++++++++++++++++++++++++--------
 fs/inode.c         |  8 ++++++++
 include/linux/fs.h |  1 +
 3 files changed, 38 insertions(+), 8 deletions(-)

-- 
2.39.2


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

end of thread, other threads:[~2023-09-07 15:40 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-31 11:24 [PATCH v2 0/2] Use exclusive lock for file_remove_privs Bernd Schubert
2023-08-31 11:24 ` [PATCH 1/2] fs: Add and export file_needs_remove_privs Bernd Schubert
2023-08-31 13:16   ` Christian Brauner
2023-08-31 13:40   ` Christian Brauner
2023-08-31 14:17     ` Bernd Schubert
2023-09-01 12:50       ` Christian Brauner
2023-08-31 11:24 ` [PATCH 2/2] btrfs: file_remove_privs needs an exclusive lock Bernd Schubert
2023-09-05 18:02 ` [PATCH v2 0/2] Use exclusive lock for file_remove_privs David Sterba
2023-09-06 14:43   ` Christian Brauner
2023-09-06 14:51     ` Bernd Schubert
2023-09-06 15:07       ` Christian Brauner
2023-09-07 14:00     ` David Sterba
  -- strict thread matches above, loose matches on Subject: below --
2023-08-30 18:15 [PATCH " Bernd Schubert
2023-08-30 18:15 ` [PATCH 1/2] fs: Add and export file_needs_remove_privs Bernd Schubert
2023-09-01  6:48   ` Christoph Hellwig

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).