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 D28AAC282C2 for ; Sun, 10 Feb 2019 22:05:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 90C8C2145D for ; Sun, 10 Feb 2019 22:05:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=rath.org header.i=@rath.org header.b="rxV41SGQ"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="O/rE3Z1U" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726118AbfBJWFl (ORCPT ); Sun, 10 Feb 2019 17:05:41 -0500 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:56965 "EHLO out2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726093AbfBJWFl (ORCPT ); Sun, 10 Feb 2019 17:05:41 -0500 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 3008F219DA; Sun, 10 Feb 2019 17:05:40 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Sun, 10 Feb 2019 17:05:40 -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= A6AMaHCHv3qk4z2scUh/AEi7kfMJnqS2nagZ+DqisdA=; b=rxV41SGQD8w6TwDJ JFSmaMdIT/U4TmbTL7zncHSXDmT1bAP8ZrpWPDL3gf3zD12ocdJJ8pnWsga49Gkm 8DyHsJAakblvgfC1UMcWJLXaQ0MSxV1RobLorPcnpt9Mfuav6d0s2p4+3zRXL5SU 11XhB2vkN7Nnl+SUcgcm6V0bRnTip8NxYpSecyu74kqKNv14O5rOrv5NuOg5XZVX 4GF5NqRbTZuMREuAGl0ADCsiIbT1CwBIQz4EQG4GDK22BoDg62ZmoEVgDjj1LnI1 Lv0o91uSFMrUq1pNICvauczr0+yr7WECTN8LLXGPt1tzdK3ZhDATSwDHQw3am3AS 4XtONQ== 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=fm2; bh=A6AMaHCHv3qk4z2scUh/AEi7kfMJnqS2nagZ+Dqis dA=; b=O/rE3Z1UJoR5e7BVjHZZQjweqcyLxTPn/eqyRXQq4t8Wwfpgy4qZoJjA9 xTFnU3p+PAxPEUtQhYrPm/E9DdU41l7d48xSlzL4opcDxXIH/FOqdHB9fBTCSVZk uhcvmwUS7Pc2VubQPk7heaScbx/HFwBbc/IORgOYbeJINe3LtFfubczsbvdlymza 7FnT+99ktzTy891A/yeXTko02BGJwwOt81obZMHJw64ZCxPlHd9aNpYabmJp7iRO ZrvJzruJ5igEb103yQUSwSRuxb4nnIHdl19C0Iq0rbNdMstAW5fS5HQzQzDX+JDj U1HXrz36R9GiD4bGDkivyUMEGe3FQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrleeigdduheekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfquhhtnecuuegrihhlohhuthemucef tddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufhffjg fkfgggtgfgsehtqhdttddtreejnecuhfhrohhmpefpihhkohhlrghushcutfgrthhhuceo pfhikhholhgruhhssehrrghthhdrohhrgheqnecukfhppedukeehrdefrdelgedrudelge enucfrrghrrghmpehmrghilhhfrhhomheppfhikhholhgruhhssehrrghthhdrohhrghen ucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from ebox.rath.org (ebox.rath.org [185.3.94.194]) by mail.messagingengine.com (Postfix) with ESMTPA id 2BBA2100E5; Sun, 10 Feb 2019 17:05:39 -0500 (EST) Received: from vostro.rath.org (vostro [192.168.12.4]) by ebox.rath.org (Postfix) with ESMTPS id EB7554D; Sun, 10 Feb 2019 22:05:37 +0000 (UTC) Received: by vostro.rath.org (Postfix, from userid 1000) id BAD38E00C8; Sun, 10 Feb 2019 22:05:37 +0000 (GMT) From: Nikolaus Rath To: Miklos Szeredi Cc: fuse-devel , linux-fsdevel 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> <87zhs7fbkg.fsf@thinkpad.rath.org> Mail-Copies-To: never Mail-Followup-To: Miklos Szeredi , fuse-devel , linux-fsdevel Date: Sun, 10 Feb 2019 22:05:37 +0000 In-Reply-To: <87zhs7fbkg.fsf@thinkpad.rath.org> (Nikolaus Rath's message of "Fri, 11 Jan 2019 15:39:27 +0000") Message-ID: <8736ovcn9q.fsf@vostro.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 On Jan 11 2019, Nikolaus Rath wrote: > 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 wro= te: >>> >> >>> >> 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=3D17fffc0= 000000ad, >>> >> >> 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 (nul= l) >>> >> >> [21932.338873] fuse: trying to steal weird page >>> >> >> [21932.338879] page=3D0000000067e3a012 index=3D64 flags=3D17fffc0= 000000ad, >>> >> >> 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 (nul= l) >>> >> >> [21936.163174] fuse: trying to steal weird page >>> >> >> [21936.163180] page=3D00000000fb80fe27 index=3D0 flags=3D17fffc00= 00000ad, >>> >> >> 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 t= he >>> >> > source of the splice()? >>> >> >>> >> Hmm. I think it has to be a regular file. But as I mentioned in my o= ther >>> >> 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. Bad news. I can now reliably reproduce the issue again. I have no clue why it disappeared for a while. This is exactly the same filesystem code, but I can't rule out that there has been some routine upgr= ade in the base system (compiler or kernel). Any suggestions for debugging this? As I said before, splice() source is a regular file on ext4, opened without O_DIRECT or DAX. If I disable FUSE_CAP_SPLICE_WRITE, the error message no longer occurs. 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