Skip to contentSkip to conversation

cluster/gfs-kernel/src/gfs inode.c inode.h ops ...

Cluster-devel [email protected] 1 participant 1 message Feb 14, 2007

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL4
Changes by: wcheng at sourceware.org 2007-02-14 23:15:44

Modified files:
gfs-kernel/src/gfs: inode.c inode.h ops_inode.c

Log message:
Final patch for bugzilla 1904745 - there is a deadlock documented in the bugzilla entry comment #26 that is messy to get around under current GFS lock order rule. To compromise the issue, we will fail the rename with the original error return code (-ENOENT), if the new ino has any possibility to cause deadlock. This implies, if GFS ino number is allocated via true random manner, we only reduce this error return code by 25%.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/inode.c.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.20.2.3&r2=1.20.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/inode.h.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.3.2.1&r2=1.3.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/ops_inode.c.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.6.2.5&r2=1.6.2.6

gfs-kernel/src/gfs/inode.c +16 -4
@@ -335,7 +335,7 @@
 
 	/* Read dinode from disk */
 	error = gfs_copyin_dinode(ip);
-	if (error)
+	if (error) 
 		goto fail_iopen;
 
 	gfs_glock_hold(i_gl);
@@ -1566,7 +1566,8 @@
  */
 
 int
-gfs_unlink_ok(struct gfs_inode *dip, struct qstr *name, struct gfs_inode *ip)
+gfs_unlink_ok(struct gfs_inode *dip, struct qstr *name, 
+	struct gfs_inode *ip, struct gfs_inum *inump)
 {
 	struct gfs_inum inum;
 	unsigned int type;
@@ -1589,11 +1590,22 @@
 		return error;
 
 	error = gfs_dir_search(dip, name, &inum, &type);
-	if (error)
+	if (error) 
 		return error;
 
-	if (inum.no_formal_ino != ip->i_num.no_formal_ino)
+	if (inum.no_formal_ino != ip->i_num.no_formal_ino) {
+		/*
+		 * Add for rename - bugzilla 190475
+		 *   return new inum such that gfs_rename can
+		 *   do its silly rename.
+		 */
+		if (unlikely(inump)) { 
+			inump->no_formal_ino = inum.no_formal_ino;
+			inump->no_addr = inum.no_addr;
+		}
+			
 		return -ENOENT;
+	}
 
 	if (ip->i_di.di_type != type) {
 		gfs_consist_inode(dip);
gfs-kernel/src/gfs/inode.h +1 -1
@@ -37,7 +37,7 @@
 int gfs_unlinki(struct gfs_inode *dip, struct qstr *name, struct gfs_inode *ip);
 int gfs_rmdiri(struct gfs_inode *dip, struct qstr *name, struct gfs_inode *ip);
 int gfs_unlink_ok(struct gfs_inode *dip, struct qstr *name,
-		  struct gfs_inode *ip);
+		  struct gfs_inode *ip, struct gfs_inum *inum);
 int gfs_ok_to_move(struct gfs_inode *this, struct gfs_inode *to);
 int gfs_readlinki(struct gfs_inode *ip, char **buf, unsigned int *len);
 
gfs-kernel/src/gfs/ops_inode.c +139 -10

224 lines not on this page · raw message