All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] loop: don't print warnings if the underlying filesystem doesn't support discard
@ 2021-09-23 19:48 Mikulas Patocka
  2021-09-24  0:17 ` Ming Lei
  2021-09-24 15:58 ` Christoph Hellwig
  0 siblings, 2 replies; 23+ messages in thread
From: Mikulas Patocka @ 2021-09-23 19:48 UTC (permalink / raw)
  To: Jens Axboe, Christoph Hellwig, Ming Lei, Zdenek Kabelac; +Cc: linux-block

Hi

When running the lvm testsuite, we get a lot of warnings 
"blk_update_request: operation not supported error, dev loop0, sector 0 op 
0x9:(WRITE_ZEROES) flags 0x800800 phys_seg 0 prio class 0". The lvm 
testsuite puts the loop device on tmpfs and the reason for the warning is 
that tmpfs supports fallocate, but doesn't support FALLOC_FL_ZERO_RANGE.

I've created this patch to silence the warnings.

Mikulas



From: Mikulas Patocka <mpatocka@redhat.com>

The loop driver checks for the fallocate method and if it is present, it
assumes that the filesystem can do FALLOC_FL_ZERO_RANGE and
FALLOC_FL_PUNCH_HOLE requests. However, some filesystems (such as fat, or
tmpfs) have the fallocate method, but lack the capability to do
FALLOC_FL_ZERO_RANGE and/or FALLOC_FL_PUNCH_HOLE.

This results in syslog warnings "blk_update_request: operation not
supported error, dev loop0, sector 0 op 0x9:(WRITE_ZEROES) flags 0x800800
phys_seg 0 prio class 0"

This patch sets RQF_QUIET to silence the warnings.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@vger.kernel.org

---
 drivers/block/loop.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Index: linux-2.6/drivers/block/loop.c
===================================================================
--- linux-2.6.orig/drivers/block/loop.c	2021-09-23 17:06:57.000000000 +0200
+++ linux-2.6/drivers/block/loop.c	2021-09-23 21:29:39.000000000 +0200
@@ -493,7 +493,16 @@ static int lo_fallocate(struct loop_devi
 	ret = file->f_op->fallocate(file, mode, pos, blk_rq_bytes(rq));
 	if (unlikely(ret && ret != -EINVAL && ret != -EOPNOTSUPP))
 		ret = -EIO;
- out:
+out:
+
+	/*
+	 * Some filesystems have the fallocate method, but lack the capability
+	 * to do FALLOC_FL_ZERO_RANGE and/or FALLOC_FL_PUNCH_HOLE requests.
+	 * We do not want a syslog warning in this case.
+	 */
+	if (ret == -EOPNOTSUPP)
+		rq->rq_flags |= RQF_QUIET;
+
 	return ret;
 }
 


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

end of thread, other threads:[~2021-10-28  4:17 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-23 19:48 [PATCH] loop: don't print warnings if the underlying filesystem doesn't support discard Mikulas Patocka
2021-09-24  0:17 ` Ming Lei
2021-09-24 15:58 ` Christoph Hellwig
2021-10-04 13:01   ` [dm-devel] " Mikulas Patocka
2021-10-04 13:01     ` Mikulas Patocka
2021-10-12  6:20     ` Christoph Hellwig
2021-10-12  6:20       ` [dm-devel] " Christoph Hellwig
2021-10-12 20:25       ` [PATCH v3] " Mikulas Patocka
2021-10-12 20:25         ` [dm-devel] " Mikulas Patocka
2021-10-13  2:56         ` kernel test robot
2021-10-13  2:56           ` kernel test robot
2021-10-13  2:56           ` [dm-devel] " kernel test robot
2021-10-13  5:06         ` kernel test robot
2021-10-13  5:06           ` kernel test robot
2021-10-13  5:06           ` [dm-devel] " kernel test robot
2021-10-13  9:28         ` [PATCH v4] " Mikulas Patocka
2021-10-13  9:28           ` [dm-devel] " Mikulas Patocka
2021-10-27  5:02           ` Dave Chinner
2021-10-27  5:02             ` [dm-devel] " Dave Chinner
2021-10-27  8:28             ` Mikulas Patocka
2021-10-27  8:28               ` [dm-devel] " Mikulas Patocka
2021-10-28  4:15               ` Dave Chinner
2021-10-28  4:15                 ` [dm-devel] " Dave Chinner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.