From mboxrd@z Thu Jan 1 00:00:00 1970 From: "J. R. Okajima" Subject: Re: [PATCH] dcache: return -ESTALE not -EBUSY on distributed fs race Date: Fri, 19 Dec 2014 00:50:38 +0900 Message-ID: <12689.1418917838@jrobl> References: <20141217195911.GF9617@fieldses.org> <20141217200153.GG9617@fieldses.org> Cc: Al Viro , linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, Jeff Layton To: "J. Bruce Fields" Return-path: Received: from mfb02-md.ns.itscom.net ([175.177.155.110]:47270 "EHLO mfb02-md.ns.itscom.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751511AbaLRP75 (ORCPT ); Thu, 18 Dec 2014 10:59:57 -0500 Received: from mail02-md.ns.itscom.net (mail02-md.ns.itscom.net [175.177.155.112]) by mfb02-md.ns.itscom.net (Postfix) with ESMTP id 1A67B170EA34 for ; Fri, 19 Dec 2014 00:50:42 +0900 (JST) In-Reply-To: <20141217200153.GG9617@fieldses.org> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: "J. Bruce Fields": > It's still kind of a bandaid, but it's the only thing I've thought of > that at least helps a little and isn't a huge pain. Any other ideas? How about introducing a tiny inline function which returns either EBUSY or ESTALE? static inline int busy_or_stale() { if (!test_distributed_fs()) return -EBUSY; return -ESTALE; } For nfs, the test function will be something like this. int test_nfsd() { int ret; struct task_struct *tsk = current; char comm[sizeof(tsk->comm)]; ret = 0; if (tsk->flags & PF_KTHREAD) { get_task_comm(comm, tsk); ret = !strcmp(comm, "nfsd"); } return ret; } I know this "by-name" test is not good. J. R. Okajima