Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp574410imu; Wed, 23 Jan 2019 01:39:35 -0800 (PST) X-Google-Smtp-Source: ALg8bN7aC4hqvW7RH5IxoyVq8xp5cdMGp0feYNTNhKEKGO2Iy72jA2XgNAfuolD3qMa6m2n6m4Tu X-Received: by 2002:a17:902:9a04:: with SMTP id v4mr1566648plp.34.1548236375542; Wed, 23 Jan 2019 01:39:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548236375; cv=none; d=google.com; s=arc-20160816; b=MSHCoMZYEMva+GdUIkZ4D6KHqTNySbIORvVde45Vy5WiQkOgcCRyt/v/hjRuK6mQHy 6Gsiq/knw00f7CaFd4OuhzAIjGDrh/LAw8M5Z1sBE8F4HP2Gw6DW5VWiyOhA807zLi53 Rc/hGbSF66AyigXBgm50fo0Ad9CxHOZulqZfBITyHvmMZg/K1zxh0334w8TspQrVzJ1V D3lEGAZaGc4g4jQuxaGW7zs5B6mslW2S8LGR4WAuKjEyxwxGolPkxgtsLIHO19Jr/+To 0wJqRWKyBGwsyZJLROFaLgJzfPUNL8zHnY68HYIO4/GFx60lxBUKMK3Qi3V+YAnHR/EU Q3Zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=fJ57WwJycFJH6Ahi8elr/glYZQZNbjb1BJu+zgLwiL8=; b=t2g4ZCmlWH+SmPt66fk0uDA9BwReQFoPteJwQLZA2dYHpM6r8Ssb1QM7zRZViTRFUX GC2WJbYyuPkVOGJH6vTYvEwRpZ0FBs1/5+CSCLDH3Y0suYKqwQS9PiqExB06kVOg28CH fCD3izDaAigkzjxYl3fKmmLjsGIzqde2e7BpZ1iNqwoTguvGXbLiP6+5a4YsN4rLhbfd Wv2JhX8Yn9gO50+CItCz9xnNWYe+XnPWTi3yRiqCZDQNJFDO8VxRK3NQ7Y1pusZBJu14 nOfx4wyiBOdCJN5lb09hS/diQrgt3xLt1zyWN0yrMtHi2aA0NLv+v+LXNt/D6zClVYFb zaYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=kGIVrMb1; 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 62si18221948plc.87.2019.01.23.01.39.20; Wed, 23 Jan 2019 01:39:35 -0800 (PST) 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=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=kGIVrMb1; 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 S1727133AbfAWJhb (ORCPT + 99 others); Wed, 23 Jan 2019 04:37:31 -0500 Received: from mail-it1-f195.google.com ([209.85.166.195]:52257 "EHLO mail-it1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726322AbfAWJha (ORCPT ); Wed, 23 Jan 2019 04:37:30 -0500 Received: by mail-it1-f195.google.com with SMTP id d11so959944itf.2 for ; Wed, 23 Jan 2019 01:37:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=fJ57WwJycFJH6Ahi8elr/glYZQZNbjb1BJu+zgLwiL8=; b=kGIVrMb1rjKlzXU4GEGYEjRUiOronkf8bCdgp1BidOqoNkOz6clY0AG+TT2iWUPsu8 oUoJ7kju0gO+qs8ZFi7ci5cRm80uHS++7swrWpU2p+2UthTf21GuVUwGLaDwhkfWOtCY BKpErWfTvRCXpv2Jy/ZK5tugWdLYqt44v4qM8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=fJ57WwJycFJH6Ahi8elr/glYZQZNbjb1BJu+zgLwiL8=; b=HB9CJdAT1/By1YNjT3xa3ws+yyx3q4c05UqRGNb5UuXaOS5/jPWAo1eVq8rZNf1Xs6 dZWM/awDXUVIa8GaezqY/dQLY35Wttz7M8gA8OpxXB0VSLoB+TJ6zWI17rINa8+pyV5K 8a6Lp/dBrOPEH3ledzJ778zy0ufMwTv7RuEwNACLvYZvNFUjHENuKrreTba+2x+GgUSZ l/GOsiz5ercBzpg9klKYRkbKJz96iY0lyrWfTRFMY+JRZLZHPKvxlkuoiHukX90kbTdh emdyyw5a/RMXPqF9nZo5eiVQgx4qMSLNhE5s6gJc+Tg+AYkqacEoyzfVCopQRIsutsJt 0TaA== X-Gm-Message-State: AJcUukdWxmmVp99S2bUDW8uqgSgm6Z42/y6uWNqb3RRVqxNH0g8jgm80 VV7BrQhR3TIdX/4+Gt7Bj/lsXrVrzBNM+r5HvrYm+K7i X-Received: by 2002:a02:8904:: with SMTP id o4mr827157jaj.35.1548236249864; Wed, 23 Jan 2019 01:37:29 -0800 (PST) MIME-Version: 1.0 References: <154151286725.17550.12307253489084032792.stgit@localhost.localdomain> In-Reply-To: <154151286725.17550.12307253489084032792.stgit@localhost.localdomain> From: Miklos Szeredi Date: Wed, 23 Jan 2019 10:37:18 +0100 Message-ID: Subject: Re: [PATCH RFC] fuse: Prevent background write requests increase inode size To: Kirill Tkhai Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 6, 2018 at 3:03 PM Kirill Tkhai wrote: > > Hi, Miklos, > > this is not a well-tested patch, this is a concept, > showing the places, where it looks we have a problem. > > Commit 7879c4e58b7c made io->async careless about inode size, > and this is wrong. Asyncronuos background requests may be sent > to userspace after inode becomes unlocked, when background > queue is throttled. In this case we execute a write request > extending inode size without any protection, and this ruines > everything. Fix that. > > Also, some write background requests do not increment fi->writectr, > e.g.: > fuse_direct_IO() > fuse_direct_io() > fuse_send_write() > fuse_async_req_send() > fuse_request_send_background() inode_lock should prevent mischief for sync DIO. For AIO DIO the order of operations is not deterministic, so it's fine if truncate and an extending AIO write race, as far as I understand. Thanks, Miklos