From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk0-f195.google.com ([209.85.220.195]:35448 "EHLO mail-qk0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751046AbdGaPxh (ORCPT ); Mon, 31 Jul 2017 11:53:37 -0400 From: Sean Anderson Subject: [PATCH] Documentation: filesystems: update filesystem locking documentation To: linux-fsdevel , linux-doc@vger.kernel.org Cc: corbet@lwn.net Message-ID: <2adf1174-ee74-5655-7b2e-3ea8b28ec2ae@gmail.com> Date: Mon, 31 Jul 2017 11:53:35 -0400 MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="rl1hXkcD7p5p6MdmaBfjqlCE2KI4KVqR3" Sender: linux-fsdevel-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --rl1hXkcD7p5p6MdmaBfjqlCE2KI4KVqR3 Content-Type: multipart/mixed; boundary="bGxabjXSd6d83vTi2pp68JKoJeVM9FPS1"; protected-headers="v1" From: Sean Anderson To: linux-fsdevel , linux-doc@vger.kernel.org Cc: corbet@lwn.net Message-ID: <2adf1174-ee74-5655-7b2e-3ea8b28ec2ae@gmail.com> Subject: [PATCH] Documentation: filesystems: update filesystem locking documentation --bGxabjXSd6d83vTi2pp68JKoJeVM9FPS1 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable Documentation/filesystems/Locking no longer reflects current locking semantics. i_mutex is no longer used for locking, and has been superseded= by i_rwsem. Additionally, ->iterate_shared() was not documented. Signed-off-by: Sean Anderson --- Documentation/filesystems/Locking | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Documentation/filesystems/Locking b/Documentation/filesystem= s/Locking index fe25787ff6d4..b098d2e50b7f 100644 --- a/Documentation/filesystems/Locking +++ b/Documentation/filesystems/Locking @@ -69,8 +69,8 @@ prototypes: =20 locking rules: all may block - i_mutex(inode) -lookup: yes + i_rwsem(inode) +lookup: shared create: yes link: yes (both) mknod: yes @@ -92,7 +92,7 @@ atomic_open: yes tmpfile: no =20 =20 - Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on + Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_rwsem on victim. cross-directory ->rename() has (per-superblock) ->s_vfs_rename_sem. =20 @@ -111,7 +111,7 @@ prototypes: =20 locking rules: all may block - i_mutex(inode) + i_rwsem(inode) list: no get: no set: yes @@ -217,7 +217,7 @@ prototypes: locking rules: All except set_page_dirty and freepage may block =20 - PageLocked(page) i_mutex + PageLocked(page) i_rwsem writepage: yes, unlocks (see below) readpage: yes, unlocks writepages: @@ -439,6 +439,7 @@ prototypes: ssize_t (*read_iter) (struct kiocb *, struct iov_iter *); ssize_t (*write_iter) (struct kiocb *, struct iov_iter *); int (*iterate) (struct file *, struct dir_context *); + int (*iterate_shared) (struct file *, struct dir_context *); unsigned int (*poll) (struct file *, struct poll_table_struct *); long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); long (*compat_ioctl) (struct file *, unsigned int, unsigned long); @@ -480,6 +481,10 @@ mutex or just to use i_size_read() instead. Note: this does not protect the file->f_pos against concurrent modificat= ions since this is something the userspace has to take care about. =20 +->iterate() is called with i_rwsem held. + +->iterate_shared() is called with i_rwsem shared. + ->fasync() is responsible for maintaining the FASYNC bit in filp->f_flag= s. Most instances call fasync_helper(), which does that maintenance, so it'= s not normally something one needs to worry about. Return values > 0 will= be --=20 2.13.2 --bGxabjXSd6d83vTi2pp68JKoJeVM9FPS1-- --rl1hXkcD7p5p6MdmaBfjqlCE2KI4KVqR3 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQGTBAEBCgB9FiEEkGEdW86NSNID6GAoPuiP7LShEG4FAll/Un9fFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDkw NjExRDVCQ0U4RDQ4RDIwM0U4NjAyODNFRTg4RkVDQjRBMTEwNkUACgkQPuiP7LSh EG4g4Qf9FK0Qp71YryhstRyaltBYw2oTwhZ0GKnXY2DtXG01hizTrzTHtXS+nbED MO+IoB2aGaEfFvjpTyJOq3rRa3ucoOEz9HMRZcp62hnmLQXix1DeLnrqyOAOoz2u 4e+oyhGpxpXJG2atoSsiLoYLFtYx/AO99FzWayzVomB5W8BwiM5mpJW4tOqwhK/C BsE36QoeZ7jM6FUtzQEUWenaGt6+sRwu3u9zGwSP5Quv6J9uJ4pAvqJ2hij2QR3F evi+dfiNUIdbBO693ZkDOF67z9fPapxnVbb7gUZt/0hGJTYCzXF/wgcgN7+OqFx7 YFepJ3TEZBA0MdGsLFZRrEvawa7YnQ== =D6c9 -----END PGP SIGNATURE----- --rl1hXkcD7p5p6MdmaBfjqlCE2KI4KVqR3--