namei: Remove icreate tfd hack
authorAndrew Deason <adeason@sinenomine.net>
Fri, 30 Aug 2013 17:23:43 +0000 (12:23 -0500)
committerJeffrey Altman <jaltman@your-file-system.com>
Wed, 3 Dec 2014 06:13:17 +0000 (01:13 -0500)
commit2f2e6effa791e3f36f002702cd72e615ccf1a1a7
tree8820ab0023681e921d70a5c10a7fe3ef68070c3a
parent47a1a786786bc7f1e3939aff9100c2196cfcb5a7
namei: Remove icreate tfd hack

Currently, the namei icreate routine creates a fake FdHandle_t for a
SetLinkCount call if we're creating a linktable. In the past this was
probably done because we did not want to open a "real" fdP ,since that
would mean opening another file descriptor, when we already had a file
descriptor (from the creating afs_open call).

This is a problem in the salvager, since it means that we can reach
ihandle code before the ihandle package has been initialized.
Specifically, we can reach icreate -> namei_SetLinkCount -> ih_fdsync.
If we reach ih_fdsync without the ihandle package being initialized,
we assert and dump core.

The ihandle package assumes that we've already initialized it if we
reach any ihandle code, since creating any IHandle_t causes the
package to initialize. But since namei_icreate fakes its own IHandle_t
and FdHandle_t structures, that doesn't happen.

So, to avoid this, stop faking our FdHandle_t and create a real one.
Since we have ih_attachfd, we can create a real FdHandle_t with our
existing file descriptor.

Change-Id: I7a8c1e0ed1ee8e5c8ce2e165b9493811d5d2435d
Reviewed-on: http://gerrit.openafs.org/10213
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
src/vol/namei_ops.c