From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C7E9C43387 for ; Fri, 11 Jan 2019 15:39:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 51CA720836 for ; Fri, 11 Jan 2019 15:39:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=temperror (0-bit key) header.d=rath.org header.i=@rath.org header.b="JKvsTIQx"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="GyrHZmVE" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731293AbfAKPjb (ORCPT ); Fri, 11 Jan 2019 10:39:31 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:40471 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728632AbfAKPjb (ORCPT ); Fri, 11 Jan 2019 10:39:31 -0500 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id E1AC522050; Fri, 11 Jan 2019 10:39:29 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Fri, 11 Jan 2019 10:39:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rath.org; h=from :to:cc:subject:references:date:in-reply-to:message-id :mime-version:content-type:content-transfer-encoding; s=fm1; bh= GzEMtQSmamXJsIgBGmMoK58pZ/344UoxVYB9OxvaAHY=; b=JKvsTIQxhp1gNSgH ZMJO2meFzxTTDKQ08DBGazdGUN4kDVasO4r+SsZaTqHIBDB8B1zXihQ7rOHPQYoh oQxpGMwxtdkWj7V/2shR27V874CAn/RB1z6GIMG+wmqdKDmFxHwM3Zbb8xvB0YlW 92GrM71ATbl8BR2FYGL4rb9haYaB35mjAFIahEtHiozZNwGWFytuwDKYbZavIfNk GS2K7qARi7U8upl8ranRbkYR+P6Zpri4qZlyTi9wl7zw3Vz2rFnFNV/Y8iKQsrTu 6vCHBu6jBjaKDXyvHcCfUhpIybMOsqHoFRNgN5ZKiMGgHlM9c2/15FWJU2/O/y2G iAwjiA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=GzEMtQSmamXJsIgBGmMoK58pZ/344UoxVYB9OxvaA HY=; b=GyrHZmVEctdx+8El7i4EUVJwyMwK2ndyzQhBKuNL0Qrk5EqYu5yl4lWiQ A1lUkL9dOhVfnCvWOfKfmk07PYL5nXGqe4Zr8Y4jHGLYUildqWqaFUYsT6lLn+rY nn9j6LCZ0ZxSI8uWZhRY7otO6K1w9vP7/uL+AlC0+BoDgP7Zh/EthcJ/wfyAFKXD UV0I3JQaMaP7FO8PGadb0NBudUrNVT1Bcyl/zIZj8rIDUX7ecfHLlEWC909lJ735 Ficsv4n5yf2qxXJwMvrJro7IRVKi4U+bGsyZnV3W2FVVWjDOJJAb8BVJoxHIsBzL 75LOuSforWdO5WTs5er8GjCCw+byw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrfeehgdejlecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufhfffgjkf gfgggtgfesthhqtddttderjeenucfhrhhomheppfhikhholhgruhhsucftrghthhcuoefp ihhkohhlrghushesrhgrthhhrdhorhhgqeenucfkphepudekhedrfedrleegrdduleegne curfgrrhgrmhepmhgrihhlfhhrohhmpefpihhkohhlrghushesrhgrthhhrdhorhhgnecu vehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from ebox.rath.org (ebox.rath.org [185.3.94.194]) by mail.messagingengine.com (Postfix) with ESMTPA id E0586102E8; Fri, 11 Jan 2019 10:39:28 -0500 (EST) Received: from thinkpad.rath.org (thinkpad [192.168.12.2]) by ebox.rath.org (Postfix) with ESMTPS id 0E6824E; Fri, 11 Jan 2019 15:39:28 +0000 (UTC) Received: by thinkpad.rath.org (Postfix, from userid 1000) id ED84DC009F; Fri, 11 Jan 2019 15:39:27 +0000 (GMT) From: Nikolaus Rath To: Miklos Szeredi Cc: fuse-devel , linux-fsdevel , Miklos Szeredi Subject: Re: [fuse-devel] fuse: trying to steal weird page References: <87o998m0a7.fsf@vostro.rath.org> <87ef9omb5f.fsf@vostro.rath.org> <87ef9nighv.fsf@thinkpad.rath.org> Mail-Copies-To: never Mail-Followup-To: Miklos Szeredi , fuse-devel , linux-fsdevel , Miklos Szeredi Date: Fri, 11 Jan 2019 15:39:27 +0000 In-Reply-To: (Miklos Szeredi's message of "Wed, 9 Jan 2019 09:07:32 +0100") Message-ID: <87zhs7fbkg.fsf@thinkpad.rath.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Message-ID: <20190111153927.vTPcAdQPDyUN1BnPOOKeWLR-6QhnApKAgcS3dxGrhJo@z> On Jan 09 2019, Miklos Szeredi wrote: > On Tue, Jan 8, 2019 at 11:35 AM Nikolaus Rath wrote: >> >> On Jan 08 2019, Miklos Szeredi wrote: >> > On Mon, Jan 7, 2019 at 10:05 PM Nikolaus Rath wrot= e: >> >> >> >> On Jan 07 2019, Miklos Szeredi wrote: >> >> > On Wed, Dec 26, 2018 at 10:44 PM Nikolaus Rath = wrote: >> >> >> >> >> >> Hi, >> >> >> >> >> >> I am seeing relatively regular occurences of >> >> >> >> >> >> $ sudo dmesg | tail >> >> >> [21929.138815] fuse: trying to steal weird page >> >> >> [21929.138821] page=3D00000000a7dd2617 index=3D64 flags=3D17fffc00= 00000ad, >> >> >> count=3D1, mapcount=3D0, mapping=3D (null) >> >> >> [21930.647338] fuse: trying to steal weird page >> >> >> [21930.647345] page=3D00000000a07f32af index=3D2848 >> >> >> flags=3D17fffc0000000ad, count=3D1, mapcount=3D0, mapping=3D (null) >> >> >> [21932.338873] fuse: trying to steal weird page >> >> >> [21932.338879] page=3D0000000067e3a012 index=3D64 flags=3D17fffc00= 00000ad, >> >> >> count=3D1, mapcount=3D0, mapping=3D (null) >> >> >> [21933.930703] fuse: trying to steal weird page >> >> >> [21933.930710] page=3D00000000046feb25 index=3D845 >> >> >> flags=3D17fffc0000000ad, count=3D1, mapcount=3D0, mapping=3D (null) >> >> >> [21936.163174] fuse: trying to steal weird page >> >> >> [21936.163180] page=3D00000000fb80fe27 index=3D0 flags=3D17fffc000= 0000ad, >> >> >> count=3D1, mapcount=3D0, mapping=3D (null) >> >> > >> >> > The page has the PG_dity and PG_waiters flags set which are >> >> > incompatible with stealing. page_cache_pipe_buf_steal() does >> >> > apparently filter out dirty ones, so it's not a regular file that we >> >> > are trying to streal the page from. So the question is: what is the >> >> > source of the splice()? >> >> >> >> Hmm. I think it has to be a regular file. But as I mentioned in my ot= her >> >> email, I did have a race condition where fd's were closed >> >> incorrectly. Is it possible that this also triggered the above, >> >> i.e. that the fd was closed sometime during splice? >> > >> > Close during a syscall that uses the fd is not an issue, because a ref >> > to the file is acquired. So the race is between the close() and the >> > internal fget(); if the close() wins then fget() will fail and the >> > syscall will return EBADF. If the fget() wins, then the syscall can >> > run normally despite the fact that the fd was closed. >> > >> > Can you tell me what filesystem is the regular file (the one being >> > spliced into fuse) is on? >> >> It's ext4. > > Next question: is file opened with O_DIRECT or is filesystem mounted > with DAX, or anything fancy? Neither. But thinking about this, I guess that (because of the race) the fd could have been closed and re-opened before the ref was acquired. So it may have turned into a directory fd. To be honest, I don't think it's worth investigating this unless I see it happen again now that the race in my code is fixed. Best, -Nikolaus --=20 GPG Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F =C2=BBTime flies like an arrow, fruit flies like a Banana.=C2= =AB