Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp521630yba; Wed, 24 Apr 2019 05:27:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqzSUvpG1BaHWzo0w9GCw+trHiWdT8ofjT1rk57u6IixlOtjHgWovoTGOz4y/soUBm1vjVhk X-Received: by 2002:a63:2c4a:: with SMTP id s71mr30201499pgs.373.1556108875095; Wed, 24 Apr 2019 05:27:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556108875; cv=none; d=google.com; s=arc-20160816; b=TXJeAgfA0Eq6BXXoDPPqGLaB0giDTqn9qbbApl6rIAN4st1e3bOcu3VfWQZ37VNVEl M8PKS6wcfizZPXNkrOASKhcXxnEqDT6pGD2eJsk2Guv5CQy2ntMYd0flYpLhlpl0eMNX YJcyieuDetoNdJqe0TjdLi4gVqbj7rAFcUwF9QNV+UUJi1ewpxOJ5Jm/t4k7GgpHs/1K 9p3hmBusQFPeEmhZXQAt10yHRE/OwaZLu+7QARwTOShRHdI9uSCpkyWjDbT8dXmQi953 mf7WVpDQhu+pY7RFj3PXWnDYMssL6EU6Xcl6D18Obtr1kc3G/nlGN+hMgaqB2eBogm2p XJEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :date:in-reply-to:references:message-id:cc:to:subject:from :dkim-signature:dkim-signature; bh=Y4gh16yRKthXYUFJ18BdzPm1Qo+DH8p1EAbtj3YooGM=; b=ykf/0BfZVcyC6bynE8geba1Bt9dUFTlJpvBC0lhrtUxlw5dHCdBDldctTQtslG/oBW I6qGLYYO40I433MjWna7j2zjnXf8UEjBxo3xDssNFjuO7BR5WtfEGxRmJV2fcsOFgwUK x+m+mXIlfcekvexIl4W6AJ+oyhm7kA1sGyd44q3zBDImYKkn8WbqU0ESKY7Imee0zYdD E0KrXV/an0OBGMfYYfhXuxn9jiHHf4mkxLxPFBZHK2ALhIA2TKQckanVPJ0koFwsxSXe l+GQu3u0ghk3Iai3Xl1046XkkXGt2xlSuF4hoUQOA6gd26g3ilD2QihmfKuzcW8Ik7rc hUyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nexedi.com header.s=mandrill header.b=Pa0cExVC; dkim=pass header.i=@mandrillapp.com header.s=mandrill header.b=lsEuEuFg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r35si10175673pgl.410.2019.04.24.05.27.40; Wed, 24 Apr 2019 05:27:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nexedi.com header.s=mandrill header.b=Pa0cExVC; dkim=pass header.i=@mandrillapp.com header.s=mandrill header.b=lsEuEuFg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729913AbfDXM0g (ORCPT + 99 others); Wed, 24 Apr 2019 08:26:36 -0400 Received: from mail133-30.atl131.mandrillapp.com ([198.2.133.30]:57609 "EHLO mail133-30.atl131.mandrillapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726880AbfDXM0g (ORCPT ); Wed, 24 Apr 2019 08:26:36 -0400 X-Greylist: delayed 904 seconds by postgrey-1.27 at vger.kernel.org; Wed, 24 Apr 2019 08:26:34 EDT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=mandrill; d=nexedi.com; h=From:Subject:To:Cc:Message-Id:References:In-Reply-To:Date:MIME-Version:Content-Type:Content-Transfer-Encoding; i=kirr@nexedi.com; bh=Y4gh16yRKthXYUFJ18BdzPm1Qo+DH8p1EAbtj3YooGM=; b=Pa0cExVCRZHPlIU6IfYtJafweLQT6X9/0I3j1Cp7BB/5IuB5wXxc8fRqcdzQRBitSV/teeNSyLjS E7om3A+GUyaagd9x2qYllYYV9NJ3uAO19ixKoYnoG/aDD5orDwBl/42LsegYPQPL6G1K/0WEdZ3j RELP9vT9IMd9xKN8lzg= Received: from pmta02.mandrill.prod.atl01.rsglab.com (127.0.0.1) by mail133-30.atl131.mandrillapp.com id ho1avk1sar8d for ; Wed, 24 Apr 2019 11:58:19 +0000 (envelope-from ) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com; i=@mandrillapp.com; q=dns/txt; s=mandrill; t=1556107099; h=From : Subject : To : Cc : Message-Id : References : In-Reply-To : Date : MIME-Version : Content-Type : Content-Transfer-Encoding : From : Subject : Date : X-Mandrill-User : List-Unsubscribe; bh=Y4gh16yRKthXYUFJ18BdzPm1Qo+DH8p1EAbtj3YooGM=; b=lsEuEuFgeOS42WgPIymv9J7fFnHK0dV3C8JR4AmphIydAEoxbiztHHPIOBS86QfnbifAY3 x/TgUBVdp+nwGl3BlaRusMnTuGPPUKNsIxSF9+BvD/cMMpwMPtGne42beMw99RL9v5hfAsMd 9eVEhpIL61ZQ2M5GL04ZwjXcOmGrI= From: Kirill Smelkov Subject: Re: [RESEND4, PATCH 2/2] fuse: require /dev/fuse reads to have enough buffer capacity as negotiated Received: from [87.98.221.171] by mandrillapp.com id ce4cab2a23e344bfa7a08370b8b1c832; Wed, 24 Apr 2019 11:58:19 +0000 To: Miklos Szeredi Cc: Miklos Szeredi , Han-Wen Nienhuys , Jakob Unterwurzacher , Kirill Tkhai , Andrew Morton , , , fuse-devel Message-Id: <20190424115815.GB2723@deco.navytux.spb.ru> References: In-Reply-To: X-Report-Abuse: Please forward a copy of this message, including all headers, to abuse@mandrill.com X-Report-Abuse: You can also report abuse here: http://mandrillapp.com/contact/abuse?id=31050260.ce4cab2a23e344bfa7a08370b8b1c832 X-Mandrill-User: md_31050260 Date: Wed, 24 Apr 2019 11:58:19 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 24, 2019 at 12:48:36PM +0200, Miklos Szeredi wrote: > On Wed, Mar 27, 2019 at 11:44 AM Kirill Smelkov wrote: > > > > A FUSE filesystem server queues /dev/fuse sys_read calls to get > > filesystem requests to handle. It does not know in advance what would be > > that request as it can be anything that client issues - LOOKUP, READ, > > WRITE, ... Many requests are short and retrieve data from the > > filesystem. However WRITE and NOTIFY_REPLY write data into filesystem. > > > > Before getting into operation phase, FUSE filesystem server and kernel > > client negotiate what should be the maximum write size the client will > > ever issue. After negotiation the contract in between server/client is > > that the filesystem server then should queue /dev/fuse sys_read calls with > > enough buffer capacity to receive any client request - WRITE in > > particular, while FUSE client should not, in particular, send WRITE > > requests with > negotiated max_write payload. FUSE client in kernel and > > libfuse historically reserve 4K for request header. This way the > > contract is that filesystem server should queue sys_reads with > > 4K+max_write buffer. > > > > If the filesystem server does not follow this contract, what can happen > > is that fuse_dev_do_read will see that request size is > buffer size, > > and then it will return EIO to client who issued the request but won't > > indicate in any way that there is a problem to filesystem server. > > This can be hard to diagnose because for some requests, e.g. for > > NOTIFY_REPLY which mimics WRITE, there is no client thread that is > > waiting for request completion and that EIO goes nowhere, while on > > filesystem server side things look like the kernel is not replying back > > after successful NOTIFY_RETRIEVE request made by the server. > > > > -> We can make the problem easy to diagnose if we indicate via error > > return to filesystem server when it is violating the contract. > > This should not practically cause problems because if a filesystem > > server is using shorter buffer, writes to it were already very likely to > > cause EIO, and if the filesystem is read-only it should be too following > > 8K minimum buffer size (= either FUSE_MIN_READ_BUFFER, see 1d3d752b47, > > or = 4K + min(max_write)=4k cared to be so by process_init_reply). > > > > Please see [1] for context where the problem of stuck filesystem was hit > > for real (because kernel client was incorrectly sending more than > > max_write data with NOTIFY_REPLY; see also previous patch), how the > > situation was traced and for more involving patch that did not make it > > into the tree. > > > > [1] https://marc.info/?l=linux-fsdevel&m=155057023600853&w=2 > > Applied. Thanks. Looking forward for it to appear in fuse.git#for-next Kirill