All of lore.kernel.org
 help / color / mirror / Atom feed
From: "J. R. Okajima" <hooanon05g@gmail.com>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>,
	linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	Jeff Layton <jlayton@primarydata.com>
Subject: Re: [PATCH] dcache: return -ESTALE not -EBUSY on distributed fs race
Date: Fri, 19 Dec 2014 00:50:38 +0900	[thread overview]
Message-ID: <12689.1418917838@jrobl> (raw)
In-Reply-To: <20141217200153.GG9617@fieldses.org>


"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

  reply	other threads:[~2014-12-18 15:59 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-17 19:59 [PATCH] dcache: return -ESTALE not -EBUSY on distributed fs race J. Bruce Fields
2014-12-17 20:01 ` J. Bruce Fields
2014-12-17 20:01   ` J. Bruce Fields
2014-12-18 15:50   ` J. R. Okajima [this message]
2014-12-18 15:58     ` J. Bruce Fields
2014-12-18 15:58       ` J. Bruce Fields
2014-12-18 16:27       ` J. R. Okajima
2014-12-18 16:27         ` J. R. Okajima
2014-12-18 17:32         ` Jeff Layton
2014-12-18 23:15         ` Dave Chinner
2014-12-18 23:15           ` Dave Chinner
2014-12-19  2:46           ` J. R. Okajima
2014-12-19 11:09             ` Jeff Layton
2014-12-19 11:09               ` Jeff Layton
2014-12-22  9:53               ` J. R. Okajima
  -- strict thread matches above, loose matches on Subject: below --
2015-02-10 15:55 J. Bruce Fields
2015-02-10 15:55 ` J. Bruce Fields
2015-02-18 15:03 ` J. Bruce Fields
2015-02-24 21:22   ` J. Bruce Fields
2015-02-24 21:22     ` J. Bruce Fields

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=12689.1418917838@jrobl \
    --to=hooanon05g@gmail.com \
    --cc=bfields@fieldses.org \
    --cc=jlayton@primarydata.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.