After all, some inodes will be created without a directory (root and
other special inodes).
Make inodbp optional too.
Signed-off-by: NeilBrown <neilb@suse.de>
mode |= S_ISGID;
} else
l->groupid = cpu_to_le32(current->cred->fsgid);
- if (LAFSI(dir)->md.file.treeid)
+ if (dir && LAFSI(dir)->md.file.treeid)
l->treeid = cpu_to_le32(LAFSI(dir)->md.file.treeid);
else
l->treeid = l->userid;
l->ctime = l->creationtime;
l->accesstime = l->creationtime;
l->size = 0;
- l->parent = cpu_to_le32(dir->i_ino);
+ l->parent = dir ? cpu_to_le32(dir->i_ino) : 0;
l->linkcount = 0;
l->attrinode = 0;
if (type == TypeDir) {
LAFS_BUG(b->my_inode != ino, &b->b);
lafs_checkpoint_unlock(fs);
- *inodbp = b;
+ if (inodbp)
+ *inodbp = b;
+ else
+ putdref(b, MKREF(inode_new));
return ino;
abort_unlock: