[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] [GFS2 Patch] GFS2: fsck.gfs2 finds unlinked inodes on full file systems



Hi,

This patch fixes a problem whereby GFS2 does not properly clean
up partially created files when the file system becomes too full.

Regards,

Bob Peterson
Red Hat File Systems

Signed-off-by: Bob Peterson <rpeterso redhat com>
--
GFS2: fsck.gfs2 finds unlinked inodes on full file systems

In some cases, when a GFS2 file system was nearly full, GFS2
was able to allocate a block for a new file's dinode but not
a second block for linking that new dinode to a directory.
In these cases, GFS2 was not properly deallocating the partially-
created file. Thus, subsequent runs of fsck.gfs2 found unlinked
files. This patch adds a an extra cleanup path to the dinode
create function to properly deallocate the partially-created file.

diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index cb81898..bc81c9d 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -708,19 +708,19 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
 
 	error = gfs2_inode_refresh(GFS2_I(inode));
 	if (error)
-		goto fail_gunlock2;
+		goto fail_dealloc;
 
 	error = gfs2_acl_create(dip, inode);
 	if (error)
-		goto fail_gunlock2;
+		goto fail_dealloc;
 
 	error = gfs2_security_init(dip, GFS2_I(inode), name);
 	if (error)
-		goto fail_gunlock2;
+		goto fail_dealloc;
 
 	error = link_dinode(dip, name, GFS2_I(inode));
 	if (error)
-		goto fail_gunlock2;
+		goto fail_dealloc;
 
 	if (bh)
 		brelse(bh);
@@ -737,6 +737,8 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
 	d_instantiate(dentry, inode);
 	return 0;
 
+fail_dealloc:
+	gfs2_dinode_dealloc(GFS2_I(inode));
 fail_gunlock2:
 	gfs2_glock_dq_uninit(ghs + 1);
 fail_gunlock:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]