[PATCH] loop: don't print warnings if the underlying filesystem doesn't support discard

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>

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@xxxxxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx

---
 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;
 }
 




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux