]> git.baikalelectronics.ru Git - kernel.git/commit
netfs: do not unlock and put the folio twice
authorXiubo Li <xiubli@redhat.com>
Mon, 11 Jul 2022 04:11:21 +0000 (12:11 +0800)
committerIlya Dryomov <idryomov@gmail.com>
Thu, 14 Jul 2022 08:10:12 +0000 (10:10 +0200)
commite059040838b279ba82d0c6b441d2c179eac16de3
treece9fe5b54a150c80acf4683288924f94a6b5cfc8
parent0c8b98e40f9d61a6792a879de085b19667a1f51b
netfs: do not unlock and put the folio twice

check_write_begin() will unlock and put the folio when return
non-zero.  So we should avoid unlocking and putting it twice in
netfs layer.

Change the way ->check_write_begin() works in the following two ways:

 (1) Pass it a pointer to the folio pointer, allowing it to unlock and put
     the folio prior to doing the stuff it wants to do, provided it clears
     the folio pointer.

 (2) Change the return values such that 0 with folio pointer set means
     continue, 0 with folio pointer cleared means re-get and all error
     codes indicating an error (no special treatment for -EAGAIN).

[ bagasdotme: use Sphinx code text syntax for *foliop pointer ]

Cc: stable@vger.kernel.org
Link: https://tracker.ceph.com/issues/56423
Link: https://lore.kernel.org/r/cf169f43-8ee7-8697-25da-0204d1b4343e@redhat.com
Co-developed-by: David Howells <dhowells@redhat.com>
Signed-off-by: Xiubo Li <xiubli@redhat.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Documentation/filesystems/netfs_library.rst
fs/afs/file.c
fs/ceph/addr.c
fs/netfs/buffered_read.c
include/linux/netfs.h