From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out1-smtp.messagingengine.com ([66.111.4.25]:35493 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726988AbeLaK4f (ORCPT ); Mon, 31 Dec 2018 05:56:35 -0500 From: Nikolaus Rath To: Miklos Szeredi Cc: Miklos Szeredi , fuse-devel , linux-fsdevel@vger.kernel.org, Sahitya Tummala , Al Viro Subject: Re: [fuse-devel] Reading from fuse pipe fails with EBADFD References: <8736rmb728.fsf@vostro.rath.org> <875zw97jfv.fsf@thinkpad.rath.org> <87k1kpxghk.fsf@vostro.rath.org> <87lg4bncnz.fsf@vostro.rath.org> Date: Mon, 31 Dec 2018 10:56:30 +0000 In-Reply-To: <87lg4bncnz.fsf@vostro.rath.org> (Nikolaus Rath's message of "Wed, 26 Dec 2018 22:30:56 +0000") Message-ID: <878t066k2p.fsf@vostro.rath.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Dec 26 2018, Nikolaus Rath wrote: >>> >> > When testing FUSE under heavy load, I am occasionally getting EBAD= FD >>> >> > errors when reading from the fuse pipe. >>> > >>> > EBADFD or EBADF? >>> >>> EBADF ("Bad file descriptor"), sorry. >> >> Can you run the thing with "strace -f ..."? > > Apologies for the delayed response. I have been trying to reproduce this > but have instead run into another problem: the *client* getting spurious > EBADF warnings. I am not sure if this is related or unrelated, and it > has been hard to debug because it does not happen under strace: [..] I believe I have figured it out. I was mistakenly assuming that the bad file descriptor was the fuse pipe - but it was actually the target file descriptor (I managed to completely forget that splice works on two file descriptors). The root cause was mistakenly closing a file descriptor twice and not checking the return value. Because of the missing return value check, the error went unnoticed almost all the time - except when a different thread managed to re-use the fd for different purposes between the first and second close. Apologies for taking everyone's time for what was actually a filesystem bug. 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