ihandle: Make sure we don't ih_attachfd invalid FD
authorAndrew Deason <adeason@sinenomine.net>
Thu, 12 Sep 2013 20:58:34 +0000 (15:58 -0500)
committerDerrick Brashear <shadow@your-file-system.com>
Mon, 30 Sep 2013 14:50:20 +0000 (07:50 -0700)
commit1cf6678fdaae82871a9aeb4addfed3a2db1954e8
tree413b109c3c210d52c50e858c7b30d9bfd61dcf78
parent6bfc2be65bbf39e6be4a8ab7f8cfbfa66bc9363a
ihandle: Make sure we don't ih_attachfd invalid FD

Right now, if you give ih_attachfd_r an invalid fd, and fdLruHead is
NULL, we'll return an FdHandle_t* for an invalid fd. Nowhere in the
code is this possible right now, but the implementation of
ih_attachfd_r and ih_attachfd doesn't make this very clear.

Ideally the "close some fds and retry" behavior in ih_attachfd_r will
be split out, so this code could be easier to follow, and we could
implement open() EMFILE retrying for icreate operations. But for now,
just make the current behavior clearer, so future modifications do not
introduce such mistakes.

Change-Id: Ibc80b32bc6f50480d12e3241fe198bc0587a962c
Reviewed-on: http://gerrit.openafs.org/10249
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
src/vol/ihandle.c