From: NeilBrown Date: Mon, 17 Aug 2009 01:52:28 +0000 (+1000) Subject: Release ino when file creation fails. X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=f2fd3ff542aeb74ff7881308d07e48e81d8f493a;p=LaFS.git Release ino when file creation fails. Due to a hack elsewhere, we need to explicitly set nlink to 0 when creation fail. The hack needs to be fixed but for now, just set nlink to 0. --- diff --git a/dir.c b/dir.c index 090ee56..b7660f5 100644 --- a/dir.c +++ b/dir.c @@ -680,6 +680,9 @@ lafs_create(struct inode *dir, struct dentry *de, int mode, abort: lafs_cluster_update_abort(&uh); dir_create_abort(&doh); + /* This is needed because import_inode sets it to 1 + * to avoid something silly. Needs FIXME */ + ino->i_nlink = 0; iput(ino); clear_bit(B_PinPending, &db->b.flags); putdref(db, MKREF(inode_new)); @@ -951,6 +954,9 @@ lafs_symlink(struct inode *dir, struct dentry *de, clear_bit(B_PinPending, &b->b.flags); putdref(b, MKREF(symlink)); dir_create_abort(&doh); + /* This is needed because import_inode sets it to 1 + * to avoid something silly. Needs FIXME */ + ino->i_nlink = 0; lafs_cluster_update_abort(&uh); iput(ino); return err; @@ -1013,6 +1019,9 @@ lafs_mkdir(struct inode *dir, struct dentry *de, int mode) abort: dir_create_abort(&doh); lafs_cluster_update_abort(&uh); + /* This is needed because import_inode sets it to 1 + * to avoid something silly. Needs FIXME */ + ino->i_nlink = 0; iput(ino); clear_bit(B_PinPending, &inodb->b.flags); putdref(inodb, MKREF(inode_new)); @@ -1089,6 +1098,9 @@ lafs_mknod(struct inode *dir, struct dentry *de, int mode, abort: dir_create_abort(&doh); lafs_cluster_update_abort(&uh); + /* This is needed because import_inode sets it to 1 + * to avoid something silly. Needs FIXME */ + ino->i_nlink = 0; iput(ino); clear_bit(B_PinPending, &inodb->b.flags); putdref(inodb, MKREF(inode_new));