[Devel,vz7] fuse: ratelimint dio complains

Submitted by Maxim Patlasov on Dec. 13, 2016, 11:29 p.m.

Details

Message ID 148167173050.17180.17198585872555776160.stgit@maxim-thinkpad
State New
Series "fuse: ratelimint dio complains"
Headers show

Commit Message

Maxim Patlasov Dec. 13, 2016, 11:29 p.m.
When userspace fuse daemon dies, from kernel pov, fuse_conn is not connected
anymore. But users may continue to issue read/write syscalls to fuse mount.
We fail them with -ENOTCONN, complaining to logs about it -- nothing wrong.
But we have to rate-limit those printks. Otherwise the node can catch
hard lockup because of too many output to console.

https://jira.sw.ru/browse/PSBM-55782

Signed-off-by: Maxim Patlasov <mpatlasov@virtuozzo.com>
---
 fs/fuse/file.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index d11125f..9cad8c5 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -846,7 +846,7 @@  static void fuse_aio_complete(struct fuse_io_priv *io, int err, ssize_t pos)
 			}
 		}
 
-		if (res < 0)
+		if (res < 0 && printk_ratelimit())
 			printk("fuse_aio_complete(io=%p, err=%d, pos=%ld"
 			       "): io->err=%d io->bytes=%ld io->size=%ld "
 			       "is_sync=%d res=%ld ki_opcode=%d ki_pos=%llu\n",
@@ -3371,7 +3371,7 @@  fuse_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
 		ret = __fuse_direct_read(io, iov, nr_segs, &pos, count);
 
 	if (io->async) {
-		if (ret != count) {
+		if (ret != count && printk_ratelimit()) {
 			struct fuse_file *ff = file->private_data;
 			printk("fuse_direct_IO: failed to %s %ld bytes "
 			       "(offset=%llu ret=%ld i_size=%llu ino=%lu "

Comments

Kirill Tkhai Dec. 14, 2016, 8:31 a.m.
On 14.12.2016 02:29, Maxim Patlasov wrote:
> When userspace fuse daemon dies, from kernel pov, fuse_conn is not connected
> anymore. But users may continue to issue read/write syscalls to fuse mount.
> We fail them with -ENOTCONN, complaining to logs about it -- nothing wrong.
> But we have to rate-limit those printks. Otherwise the node can catch
> hard lockup because of too many output to console.
> 
> https://jira.sw.ru/browse/PSBM-55782
> 
> Signed-off-by: Maxim Patlasov <mpatlasov@virtuozzo.com>

Acked-by: Kirill Tkhai <ktkhai@virtuozzo.com>

> ---
>  fs/fuse/file.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/fuse/file.c b/fs/fuse/file.c
> index d11125f..9cad8c5 100644
> --- a/fs/fuse/file.c
> +++ b/fs/fuse/file.c
> @@ -846,7 +846,7 @@ static void fuse_aio_complete(struct fuse_io_priv *io, int err, ssize_t pos)
>  			}
>  		}
>  
> -		if (res < 0)
> +		if (res < 0 && printk_ratelimit())
>  			printk("fuse_aio_complete(io=%p, err=%d, pos=%ld"
>  			       "): io->err=%d io->bytes=%ld io->size=%ld "
>  			       "is_sync=%d res=%ld ki_opcode=%d ki_pos=%llu\n",
> @@ -3371,7 +3371,7 @@ fuse_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
>  		ret = __fuse_direct_read(io, iov, nr_segs, &pos, count);
>  
>  	if (io->async) {
> -		if (ret != count) {
> +		if (ret != count && printk_ratelimit()) {
>  			struct fuse_file *ff = file->private_data;
>  			printk("fuse_direct_IO: failed to %s %ld bytes "
>  			       "(offset=%llu ret=%ld i_size=%llu ino=%lu "
>