On Fri, Dec 19, 2014 at 12:50:38AM +0900, J. R. Okajima wrote: > > "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; > } Why do you think -EBUSY's the right error in the local filesystem case? This condition really shouldn't happen in the local filesystem case anyway. If anything maybe it should be -EIO, since it looks like a sign your filesystem's corrupted. > 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. Also you'd want to be checking for nfs, not nfsd. --b. -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html