]> git.neil.brown.name Git - LaFS.git/commitdiff
Release ino when file creation fails.
authorNeilBrown <neilb@suse.de>
Mon, 17 Aug 2009 01:52:28 +0000 (11:52 +1000)
committerNeilBrown <neilb@suse.de>
Mon, 17 Aug 2009 01:52:28 +0000 (11:52 +1000)
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.

dir.c

diff --git a/dir.c b/dir.c
index 090ee5629a09651da69d9f99e152bcaa5a2e861e..b7660f599fe3b2149298e5d85132a502f21b78c7 100644 (file)
--- 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));