7 ms·
We spent two weeks hunting an NFS bug in the Linux kernel (2018)
- akersten 6y agoThis is a really detailed writeup and a huge amount of effort clearly went into the post. The NFS maintainer seems to agree that this was a bug worth fixing. But I think I'm missing something - doesn't the specification say that the observed behavior (the file handle having gone stale) is acceptable, based on this snippet: > A filehandle may or may not become stale or expire on a rename. However, server implementors are strongly encouraged to attempt to keep file handles from becoming stale or expiring in this fashion. So, is it more of a 'the specification isn't sufficient for real world usage' kind of fix, or was something actually broken?
- misnome 6y agoI understood that it’s an acceptable Server response, as per spec, but it’s a bug on the client that it asks for the now-invalid file handle even though it’s had it’s delegation withdrawn - from the client’s perspective it has no reason to assume that the file even exists any more. And yes, this is an excellent writeup.
- Someone 6y ago“the specification isn't sufficient for real world usage” I think that sums up NFS reasonably well. “Let’s make the API connectionless and stateless; that simplifies things” is true, but implementing Unix semantics, where files can be opened or closed, file deletes change state, file deletes aren’t seen by open file handles, programs want to do record locking, etc. on top of it? Maybe not the best of ideas. There’s a reason S3 isn’t a file system. (See also The UNIX Haters Handbook chapter on the Nightmare File System)
- tinus_hn 6y agoOriginally you could run with NFS as your only storage, even swapping on NFS. If the server rebooted the clients would get stuck but resume once it came back up. This requires some hard to deliver guarantees from the server.
- Someone 6y agoFrom what I understand, that only worked if the processes making NFS requests kept retrying long enough. But yes, being stateless has the advantage that the server won’t lose connections, open file state, etc. across client or server restarts. That’s useful, but if you assume you have a file system (which NFS claims to be), and want to use those features, you’re asking for problems. NFS is aan example of “worse is better”.
- tinus_hn 6y agoThe idea was they’d keep trying forever which typically is long enough. The downside is if you retire a server all the clients that still have files open will hang.
- guenthert 6y agoNFS isn't stateless since NFSv3 was introduced more than 25 years ago. There was a remote fs before NFS which closely mimicked Unix file system semantic (AT&T's RFS). There's a reason you don't read much about it.
- tbrock 6y agoWhy is anyone using NFS?
- dboreham 6y agoReally. I was about to comment "don't use NFS".
- geofft 6y agoCan you expand on that / why not? It's certainly possible to use NFS in places where other tools would work better, but if the thing you actually want is filesystem semantics from multiple clients, NFS is definitely one of your better options, as far as I know / in my experience.
- tryauuum 6y agoThe authorization scheme sucks.
- Proven 6y agoAs opposed to what?
- geofft 6y agoCan you expand on that? Which authorization scheme are you thinking of? I've run global-scale NFS deployments with sec=sys before and I wouldn't say it sucked.
- tryauuum 6y agoso say if you have an NFS share (server A) on a public IP-address, and NFS client (server B), that mounts an NFS share with that sec=sys option. Doesn't that mean that a rogue server C can connect to server A and impersonate any user?
- 6y ago
- dang 6y agoDiscussed at the time: https://news.ycombinator.com/item?id=18556775 https://news.ycombinator.com/item?id=18556775
- ncmncm 6y agoI found it very distracting to be told that things "beg the question" that really did not. Only a person can beg the question, and then only if they are either very confused or are trying to deceive you.
- amscanne 6y agoThe “misuse” of the term is so common that it is now included without comment in many dictionaries and reference sources (e.g. Wikipedia). The formal fallacy is now the more uncommon use, so it’s probably worth getting over it ;)
- iso8859-1 6y agoStrictly speaking, petitio principii is not a fallacy of reasoning but an ineptitude in argumentation: thus the argument from p as a premise to p as conclusion is not deductively invalid but lacks any power of conviction, since no one who questioned the conclusion could concede the premise. (this was a quote from the Britannica)
- angrygoat 6y agoI used to work with a fairly large HPC environment which had a large number of NFS attached disks. One of the issues we ran into was unlink() on ext4; it could take quite a long time for large (TB..) files on busy servers. NFS would eventually timeout the request, the client would retry the operation, and get ENOENT back. It turned out that while ext4 blocked until it'd finished every detail of unlink(), the name was immediately removed from the filesystem namespace. NFS is in the category of works well enough, but the edge cases are a mile wide!
- m463 6y agoWow, that brings back memories. Like "why not mount with intr?" Because NO. (wait, or was it soft mounts?)
- guenthert 6y agoSoft mounts may cause silent data corruption (it's actually the applications which don't check the return code on file system operations which cause the corruption, but there are just too many of those). Just don't do it. People sometimes (ignorantly and irresponsibly) recommend (or have recommended -- NFS is squarely in the legacy corner of technology) soft mounts in an attempt to deal with unreliable servers, i.e. prevent clients from 'hanging' if the server doesn't respond. The real solution is of course to fix the darn server / the network.
- formerly_proven 6y agoNFS is a gruesome mess when files aren't exclusively used by a single client (namespace and time(!). A lot of "classic unix" ideas are very, very bad ideas on NFS and will either not work at all (good) or silently sometimes randomly discard data (juck).
- yencabulator 6y agoNFSv4(.1) was largely created to fix this. It has delegations, a mechanism for clients to have coherent caches and exclusivity when needed. As far as I know it works just fine, the world just mostly moved away from wanting NFS.
- ridiculous_fish 6y agoHow do others test their software on slow NFS? I hacked up a deliberately slow NFS server [1], but it's awkward to deploy, and I don't think it's representative of real-world, so it's not part of any automated suite. 1: https://github.com/ridiculousfish/SleepyFS https://github.com/ridiculousfish/SleepyFS
- neurostimulant 6y agoPackaging it as a docker image is a common way to make deployment easier. Your nfs server seem to be a good fit for a docker image as everything runs in user space.
- vfclists 6y agoDidn't the programmers' grandfathers warn them that "GOTO is considered harmful"? To paraphrase Macbeth - "Is this a GOTO I see before me? Come, let me hold you. I don’t have you but I can still see you. Fateful apparition, isn’t it possible to touch you as well as see you? Or are you nothing more than a GOTO created by the mind, a hallucination from my fevered brain? I can still see you, and you look as real as this other GOTO that I’m pulling out now ..."
- coolspot 6y agoIn my case it was my strict grandmother. Everytime she found GOTO in my code, she spanked my hands with a stick.
- Dylan16807 6y agoWhy does it matter? The GOTO wasn't the problem, and GOTO is a reasonable solution to doing cleanup in C. The problem is the code forgot to check for a particular situation: https://marc.info/?l=linux-nfs&m=153807208928650&w=2 https://marc.info/?l=linux-nfs&m=153807208928650&w=2