[PVFS2-CVS] commit by robl in pvfs2-1/src/apps/admin: pvfs2-fsck.c

CVS commit program cvs at parl.clemson.edu
Fri Oct 1 13:12:09 EDT 2004


Update of /projects/cvsroot/pvfs2-1/src/apps/admin
In directory parlweb:/tmp/cvs-serv13790/src/apps/admin

Modified Files:
	pvfs2-fsck.c 
Log Message:
match before creating so we can delete the object if the match fails.


Index: pvfs2-fsck.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/apps/admin/pvfs2-fsck.c,v
diff -u -w -p -u -r1.10 -r1.11
--- pvfs2-fsck.c	29 Sep 2004 20:27:53 -0000	1.10
+++ pvfs2-fsck.c	1 Oct 2004 16:12:09 -0000	1.11
@@ -868,19 +868,32 @@ struct handlelist *fill_lost_and_found(P
 		}
 		break;
 	    case PVFS_TYPE_DIRECTORY:
-		sprintf(dirname + 8, "%Lu", Lu(handle));
+                /* assumption: we will often suceed in creating a new entry,
+                 * but if the file system is messed up we may not be able to
+                 * find dirdata, so match_dirdata before create_dirent */
+		if (match_dirdata(hl_all,
+				    alt_hl,
+				    handle_ref,
+				    creds)  != 0)
+                {
+                    ret = remove_object(handle_ref, 
+                            getattr_resp.attr.objtype,
+                            creds);
+                    assert(ret == 0);
+                }
 
+		sprintf(dirname + 8, "%Lu", Lu(handle));
 		ret = create_dirent(laf_ref,
 				    dirname,
 				    handle,
 				    creds);
-		assert(ret == 0);
-
-		ret = match_dirdata(hl_all,
-				    alt_hl,
-				    handle_ref,
+                if (ret != 0)
+                {
+                    ret = remove_object(handle_ref,
+                            getattr_resp.attr.objtype,
 				    creds);
-		assert(ret == 0);
+                }
+
 		break;
 	    case PVFS_TYPE_DATAFILE:
 #if 0



More information about the PVFS2-CVS mailing list