From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.openvz.org (unknown [69.168.225.77]) by lore.virtuozzo.com (Postfix) with ESMTPS id C06068015B for ; Tue, 22 Sep 2026 15:55:46 +0000 (UTC) Received: from mail.openvz.org (localhost [127.0.0.1]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 68MFsRmB019759; Tue, 22 Sep 2026 18:54:28 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 68MFsRmB019759 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="syixe0r2" Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 68MFsN0s019755 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Tue, 22 Sep 2026 18:54:24 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 68MFsN0s019755 Received: by mail-pj1-f71.google.com with SMTP id 98e67ed59e1d1-38e8e864ef0so97416a91.0 for ; Tue, 22 Sep 2026 08:54:24 -0700 (PDT) X-Gm-Message-State: AFuF++ljQsMJs4xR4xoEc4x9YkuWKSXVQr4T0eTcevq1lEia9k7/KLqc ZB6iDTYmYOxuvwUm97qSRrB6/laxTWe7eQyhCxtDyrTwjOEAphVo/WZ0F9f6iTsE8O7fI4+nevp XlKUCB99Y+/4YdS1oWq0ALt23M9ucOPLbdAa3+Z9Xukrotdvj13G4nQ== X-Gm-Gg: AYBFou2nSLICzngjmNcnHvYA+nQN9rM7wY2RczIURFmHcxMjtu0ipTQBfCKaLBuiZ47 Y8ymKgoCxwbhXtIRxp+OLq0LSTbDtS0FL+2IprXsfyRORx6Q12iZJMdDHg21ASzMIWbfd/bgc+K /O9ZY9IHwgoUADQhe65xYIQ3LLpBmbuioN84/NUOPOQxICD2aYgB1vEzGuXF5XYTkiSU6k1Lezy rjV7j/INlZ3SiMGF+VZHyZe4OyeaYWtXyoAZFYdW4PP8W1l69fDOoUWoH+hTFMJGqP1q/P4IBBI 0elCekEDXmJaTRvB3Pu1o+YrQoXFWr2kb0Zron1j1Xdi8kcvUOfJqpdSCTOaRjoVFx1AvDNaCL1 SmbekdL//KNc41egne7HCKgA1hoAn/BqjUz7DGgIlsVLwxwRiFvU2L+sOD9LMIadlFSyRpmK9D+ 4/JmcUQugvoHyJDy2Q/aKv X-Received: by 2002:a17:90b:1b42:b0:39e:6c69:7773 with SMTP id 98e67ed59e1d1-3a073233f70mr1645999a91.28.1790092462910; Tue, 22 Sep 2026 08:54:22 -0700 (PDT) X-Received: by 2002:a17:90b:1b42:b0:39e:6c69:7773 with SMTP id 98e67ed59e1d1-3a073233f70mr1645976a91.28.1790092462202; Tue, 22 Sep 2026 08:54:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1790092462; cv=pass; d=google.com; s=arc-20260327; b=nLfjyc2VmR2qySelXsM2YJFoA7N3pQqTyywp2Ld5JXd6w/EqTZIxMD+BXfyd6YuEam 01dDuMOfca6383TsCqPemaRs1Htb977RH2uny+XCcvkUq965vkiOZGTqNo2bq0X5eLhN waTCyd8SaaU7ZICsTd4CoEgxAJGmjdLAoGENyc6xWy/+TIZoO5tKRYk8LiRqsjz7zy7/ mU3zw6J0I+1l1yyOdEhjc+aNZGNSyQOGo5WU2EO7Vpt3ITnYoB0/UglXJ3Sz3+I5eSjx c5eENz1Z1NE9SE4YtpprR6yqpDmIlUvgOndBVNBOtg/PAvaeQX/y4He6lm7kBOsD0+iO uwUg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=mime-version:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:date :message-id:dkim-signature; bh=I7WVIcx/Y+XGthLy2Vfzw2DPkaxtqXv5sO0Xtt3AcLg=; fh=UHCoYYESnLjq3p6u+/KwK8AIdQZFyLwepi/BwM47ce8=; b=rxWTlKE7ZWtxQ4X5WE6btLr+Pq4bXAi5g6FFT3QEn7lL0lJyxBKumNB4weQmy+Fn8D gPkhUlwQobI8FpX86d/23xhhkZieEcw1jCq0Ha2thjgR81/KqNQP5xkXcCwAROt7gfMK 7Letjz16ic46ZQwoPRfzGOuQlfYjCCS2jtxGICwgmCP6eYyiauwplgiWFSxeo6LIZALj 8qulGkxjaYoquuzAQH2jkaVCa2ypJzmKKxpXEBl8y5nbNnSAKFhPx60hk4esWAVtnFW1 lTwl00D0v7rX1E2EyxswLmYUbypbe+Wi/Y1hfp//qpmHUU7addMOBn3ohbHWowXkhyDS tCCQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector2 header.b=syixe0r2; arc=pass (i=1 spf=pass spfdomain=virtuozzo.com dkim=pass dkdomain=virtuozzo.com dmarc=pass fromdomain=virtuozzo.com); spf=pass (google.com: domain of khorenko@virtuozzo.com designates 2a01:111:f403:c200::3 as permitted sender) smtp.mailfrom=khorenko@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazlp170110003.outbound.protection.outlook.com. [2a01:111:f403:c200::3]) by mx.google.com with ESMTPS id 98e67ed59e1d1-3a07da31fb6si269625a91.11.2026.09.22.08.54.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2026 08:54:22 -0700 (PDT) Received-SPF: pass (google.com: domain of khorenko@virtuozzo.com designates 2a01:111:f403:c200::3 as permitted sender) client-ip=2a01:111:f403:c200::3; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector2 header.b=syixe0r2; arc=pass (i=1 spf=pass spfdomain=virtuozzo.com dkim=pass dkdomain=virtuozzo.com dmarc=pass fromdomain=virtuozzo.com); spf=pass (google.com: domain of khorenko@virtuozzo.com designates 2a01:111:f403:c200::3 as permitted sender) smtp.mailfrom=khorenko@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ms8SJzi3tPFUBSxbViU8tOpQ9paeLuTuik5r0Q+eNaykz9gPK0Dmkr5QquefNAb4JSPQjtRUD0FOtjZAd7IZV/0s49hM8spZ/YQ/042G5PnuvUa6w+QhC38xDGD48TpWOkp0hXjn8nVCmFPJeqYKQeBafkfbOqMeI6R9XsEAI80jE2K8Zu5iYUhykYApcm7/Lj8ZOx+SyhTLs+bRrQH41nTKFxw66A2TtjI4hQsK6jxwlyX3u1GiwNZGeo0TDGNZJP9Rffsl+UpdCqjbQn0PxRr+i6/o0T7j0E+dWuRouyEJH4bEHj61d9TxI5dSnFlwu4mTSqRLxjX/vZFMhM6hVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=I7WVIcx/Y+XGthLy2Vfzw2DPkaxtqXv5sO0Xtt3AcLg=; b=cvFcjCuzqdysyx2pgu+u6rdPWFeN5qTlaYc69RXF6Zhe8SZyQjwyJNyM9XO1qMhjBXqyNnwBbbSvnAvDVw0HuMvCK4Xg9SVvuJt/yHyvKfA/qHl3kdcqLxSBuoXBBGO/XD5f0122mHXtiG7FSD2QP3NV8UH12EekLhfX4z+XgQYgdq0rnzXHbZ2H4cPh5EQKpy8L28AFj/T7UvF4S6qpB1j29n+o+bzwxYbL+Kro/UZ6rXErOBr6qaZECkt+gBjI3zeqNM4IPZNNWX7e6f4a9mv0BOGQ65IGqAUDlwicbG/qf7/XKkDEJsAkA+Wprp3Q9Ei7RuUu4ws5wWSaSYOGfw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=I7WVIcx/Y+XGthLy2Vfzw2DPkaxtqXv5sO0Xtt3AcLg=; b=syixe0r2uBLmTMfoT7unrKeMS6C/aOSwtK2tUjZahhZzjVF0FuN2KdmpU6pZXxxSPFKmQvJDE2jLgZ6cKKryIQTmwE4o/Uff+L3Yy1abjVtxPPE9jS3vFuJs6h2b0HBCW8BJLcgDVn87BmHzmuJiCj1AHqZyEfFj0BMQ7vtG1AicH3hlyZhmQXjcz90K+FZX/AJn1yEM0fhafYGE1gGNhtEkYgWfjNrgcuMQ/RJzTpF9dZbKTway2hwSe8YdH6TQ8MixU0QmLfWKtangWzBVTziB/sdH2pUcjsyfomLiYrJZMkwqcEPPSPuFcFXzUWzvJ0va6QV1ewbR/gN1qIOzYQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from PA6PR08MB10708.eurprd08.prod.outlook.com (2603:10a6:102:3c7::20) by PAVPR08MB9651.eurprd08.prod.outlook.com (2603:10a6:102:31b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.451.13; Tue, 22 Sep 2026 15:54:18 +0000 Received: from PA6PR08MB10708.eurprd08.prod.outlook.com ([fe80::1999:c6db:dc55:494a]) by PA6PR08MB10708.eurprd08.prod.outlook.com ([fe80::1999:c6db:dc55:494a%5]) with mapi id 15.21.0451.012; Tue, 22 Sep 2026 15:54:17 +0000 Message-ID: <13c80cb1-aa09-455a-b829-f5e08efe937c@virtuozzo.com> Date: Tue, 22 Sep 2026 17:54:16 +0200 User-Agent: Mozilla Thunderbird To: Liu Kui References: <20260922-vstor-145614-v1-1-e14dd025e85a@virtuozzo.com> Content-Language: en-US, ru, sr From: Konstantin Khorenko In-Reply-To: <20260922-vstor-145614-v1-1-e14dd025e85a@virtuozzo.com> X-ClientProxiedBy: AM8P190CA0004.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:219::9) To PA6PR08MB10708.eurprd08.prod.outlook.com (2603:10a6:102:3c7::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PA6PR08MB10708:EE_|PAVPR08MB9651:EE_ X-MS-Office365-Filtering-Correlation-Id: 6668d255-c706-4740-fcc2-08df18c1c239 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|366016|376014|23010399003|13003099007|6133799003|56012099006|5023799004|10067099003|18002099003|17002099007|22082099003; X-Microsoft-Antispam-Message-Info: r3xAkWB0ANuP/FRtVv3i38nsAx3q9Z+XfbFkzzAtjC8oTTKQFphszQgdChSqoyRBjilcr5mSIkIMmHQTF/vkTJ1YGo2xT7oAvifTpPXxSJuH7jX9AFW2mtSXvSzqfK1csXyqztVdgjSTiao5xr4FLkxSR3LEwXFEHIzKjEog4gxAb+Zt4i4zwEXfXm2vqpfKlRPWC24Lqdv0FXChWoGmJUCov4N9H1D7SovY9a0TxyhSfbH9dmdtN+0Q9PAJngGnig3c/xSZWJF+tici/R+xH5EY1L2yG3kGFHNUE4fiCU0gS+Rb9FaUcPclve84yq3p/A41qT1+MIHuD+E80fb8JuF3klTWzffRIWZ+ryC55QNVtyRAnjXZa4Zg85Ca7qnQVLHXRiyA11/xFZiqp/UYqIfvzVu/s4WX8z9qkH8Tv8cEI69F2Koe2WaTyznu0T2UyS1SgjZ+tfe/JGyQT5K3nNnoy/FA8eLAFCWbeehIGTHZnGObDwE6mbBGm+BAnMzudj4iK4TdIDZV5MMEanIPjphJibEh312eb7d2JZs32HkQ1jPCC8aMRwMb78oMb+CIjgAD6JAhN46WK2Lp3GEcvg1k8BwNm8HUVVMFpzn9TDDKHv2WNmsYhVgBl5/dGY+BW9AjTC/46ZKop2YRnLenm9SJ1cy3TJ/yZv+aVfOe9KU= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PA6PR08MB10708.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(376014)(23010399003)(13003099007)(6133799003)(56012099006)(5023799004)(10067099003)(18002099003)(17002099007)(22082099003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?ZS9UQkw3WlZUUlJiS01Tb1R5ZTVWTGVhWENOVnd2ai8vMURwNXRyc1ZpZUJK?= =?utf-8?B?ckNrQXAyYy9xRG1SMEFiQWN6OTdqc09aazk1d2RaU2tzalpMM0RVZXhNWEsw?= =?utf-8?B?b2Jtd3BjWGlMTzhwdTVRWUhjKzcrRC91TmFvYzczNElxcVA2QXlVL2hvYWxi?= =?utf-8?B?SUIraWUvWEQzc0xwc2I5NllPMmVFd3FqeEZQR1UxWDhuOUZ2UHllTm85aExa?= =?utf-8?B?MWpvNzhnUlpzZm82SUhIWThOUWxYeVpOaE5rdkZyU2VyWklXbTNnekhxbkI0?= =?utf-8?B?c0ZDS3pyMGI4bm5XbmprL1UrenFvRG9MNzVlRWsvQWxMWkNvdkZmUWhjV0hi?= =?utf-8?B?NmtQeGdiWnBPWE9sdGNSdFRtUVNDVmNaeC8wdUZ4QlMxNVlrejJodWJmTWM4?= =?utf-8?B?U1hycTBUclQrZ3pMY3ZhL1M2L1VYdS9ZOHExRmo3bGR1RkVSREt3N1dxRlEr?= =?utf-8?B?UXdYcHpmb3VJdXIrTTVuclJWTTFOdWk2UmVoSFhRN21mdElwYlYwWTBhR2dC?= =?utf-8?B?Z09jLzRoQUdJMjRWcGVCZTR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21wV3ZtUT09?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6668d255-c706-4740-fcc2-08df18c1c239 X-MS-Exchange-CrossTenant-AuthSource: PA6PR08MB10708.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2026 15:54:17.7711 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: nYLaxfCPisVd6ZSvgkrICMA2DaWqTxNP+zSqeL5MBwO9SxQM1ZY6zqyIAlnf2h7cV56wltUC/6klBmEkSl7+Kg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAVPR08MB9651 X-OZ-Fwd: true Cc: azaitsev@virtuozzo.com, devel@openvz.org Subject: Re: [Devel] [PATCH hci-8.0] fs/fuse: fix fuse file refcount leak on close_wait writeback X-BeenThere: devel@openvz.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: OpenVZ development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: devel-bounces@openvz.org Errors-To: devel-bounces@openvz.org Reverting to the old model brings back its latent defect. The defect. An aux request takes two fields from different files: - write.in.fh and args->ff are filled from the ff at fill time (fs/fuse/file.c:2791, fs/fuse/file.c:1478). - The reference taken at promotion is on the primary request's ff (fs/fuse/file.c:2377). While the aux sits in the chain, it holds no reference on its fill-time ff. With close_wait this means fuse_release of that file passes its wait_event and frees the ff. Scenario: 1. ffA writes a page, the primary wpa holds a reference on ffA. 2. ffA is closed, fuse_release blocks in wait_event, ffA is removed from write_files. 3. ffB writes the same page and ends up as an aux with args->ff = ffB and ffB's fh. 4. ffB is closed. The aux holds no reference, so release passes, FUSE_RELEASE is sent, ffB is freed. 5. The primary completes, the aux is promoted with a reference on ffA and goes out. Consequences at step 5: - fuse_request_queue_background dereferences the already freed ffB (fs/fuse/dev.c:663). - The request goes out with an fh userspace has already released. Status. This is pre-existing vz9 behaviour, the patch does not introduce it. But the mainline model, where every wpa holds a reference on the ff whose fh it uses, closed it as a side effect. This patch takes that away. An alternative of roughly the same size fixes both bugs: - Keep the mainline model: the reference is taken when the wpa is allocated. - Drop the put from fuse_writepage_finish. - In fuse_writepage_free call fuse_release_ff(wpa->inode, wpa->ia.ff). It already does the close_wait split with wake_up under fi->lock. All three fuse_writepage_free callers run without fi->lock, so this fits without reordering anything. You mention this option yourself in the "Note:", so this is not something new, the question is - are we ok to revert to the old ms scheme without that global rework? -- Best regards, Konstantin Khorenko, Virtuozzo Linux Kernel Team On 9/22/26 15:53, Liu Kui wrote: > Mainline commit 4046d3adcca4 ("fuse: move fuse file initialization to > wpa allocation time") moved acquisition of the wpa's fuse file > reference from submit time (fuse_writepages_send) to wpa allocation > time, and compensated by dropping the reference unconditionally in > fuse_writepage_free(). > > This breaks the close_wait accounting in the vz tree, which splits the > drop between two functions: fuse_writepage_finish() does > __fuse_file_put() for close_wait (allowing fuse_release() to pass > wait_event(ff->count == 1)), while fuse_writepage_free() puts the > reference only for !close_wait. This split requires that every wpa > owning a reference passes through fuse_writepage_finish() before being > freed. Two paths free a wpa without calling it: > > - fuse_writepage_add(): temp page swap case frees the new wpa > - fuse_send_writepage(): out_free path frees the aux request chain > > Before that commit these paths only ever saw wpas with ia.ff == NULL > (never submitted or promoted), so nothing leaked. After it, every wpa > owns a reference from birth, and on close_wait mounts both paths leak > it: ff->count never returns to 1, fuse_release() hangs forever in > wait_event(), and the fuse file and its FUSE_RELEASE are leaked. > > Fix it by reverting to the old ownership model for the writeback path: > a wpa is allocated with ia.ff = NULL and acquires the reference at > submit time (fuse_writepages_send, fuse_writepage_locked) or at aux > promotion time (fuse_writepage_end). Also make fuse_writepage_free() > derive fuse_conn from wpa->inode since ia.ff may now legitimately be > NULL there. > > Note: this is effectively a revert of the mainline change for the > writeback path. It can be restored later on a rework of the close_wait > accounting (e.g. dropping the finish/free split in favour of an > unconditional put). > > https://virtuozzo.atlassian.net/browse/VSTOR-145614 > > Signed-off-by: Liu Kui > --- > Fix a fuse file refcount leak on close_wait mounts introduced by the > rebase to mainline commit 4046d3adcca4 ("fuse: move fuse file > initialization to wpa allocation time"): wpas freed without going > through fuse_writepage_finish() (aux temp-page swap, killed aux chains) > now own a reference nobody drops, so fuse_release() hangs forever in > wait_event(ff->count == 1). Restore the old ownership model (reference > acquired at submit/promotion time) for the writeback path. > > https://virtuozzo.atlassian.net/browse/VSTOR-145614 > --- > fs/fuse/file.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/fs/fuse/file.c b/fs/fuse/file.c > index 180f60fc539a..50d3f8186d39 100644 > --- a/fs/fuse/file.c > +++ b/fs/fuse/file.c > @@ -2181,7 +2181,7 @@ static ssize_t fuse_splice_write(struct pipe_inode_info *pipe, struct file *out, > static void fuse_writepage_free(struct fuse_writepage_args *wpa) > { > struct fuse_args_pages *ap = &wpa->ia.ap; > - struct fuse_conn *fc = wpa->ia.ff->fm->fc; > + struct fuse_conn *fc = get_fuse_conn(wpa->inode); > int i; > > if (wpa->bucket) > @@ -2374,6 +2374,7 @@ static void fuse_writepage_end(struct fuse_mount *fm, struct fuse_args *args, > > wpa->next = next->next; > next->next = NULL; > + next->ia.ff = fuse_file_get(wpa->ia.ff); > tree_insert(&fi->writepages, next); > > /* > @@ -2523,7 +2524,7 @@ static struct fuse_writepage_args *fuse_writepage_args_setup(struct folio *folio > fuse_write_args_fill(&wpa->ia, ff, inode, folio_pos(folio), 0); > wpa->ia.write.in.write_flags |= FUSE_WRITE_CACHE; > wpa->inode = inode; > - wpa->ia.ff = ff; > + wpa->ia.ff = NULL; > > ap = &wpa->ia.ap; > ap->args.in_pages = true; > @@ -2561,6 +2562,7 @@ static int fuse_writepage_locked(struct folio *folio) > if (!wpa) > goto err_writepage_args; > > + wpa->ia.ff = ff; > ap = &wpa->ia.ap; > ap->num_pages = 1; > > @@ -2628,6 +2630,7 @@ static void fuse_writepages_send(struct fuse_fill_wb_data *data) > int num_pages = wpa->ia.ap.num_pages; > int i; > > + wpa->ia.ff = fuse_file_get(data->ff); > spin_lock(&fi->lock); > list_add_tail(&wpa->queue_entry, &fi->queued_writes); > fuse_flush_writepages(inode); > @@ -2791,7 +2794,6 @@ static int fuse_writepages_fill(struct folio *folio, > folio_redirty_for_writepage(wbc, folio); > goto out_unlock; > } > - fuse_file_get(wpa->ia.ff); > data->max_pages = 1; > ap = &wpa->ia.ap; > > > --- > base-commit: 978369605ab89b48b86d12af9f8dda88689ed5ca > change-id: 20260922-vstor-145614-10a4ac579905 > > Best regards, > -- > Liu Kui > _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel