Skip to contentSkip to conversation

Lustre VFS patches for 2.6

PATCH In review Oleg Drokin 1 participant 1 message Jul 7, 2004 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 8/9 Lustre VFS patches for 2.6

Mark lookup of last path element so that filesystems can distinguish it and e.g. perform some actions based on information in intent.

 fs/namei.c            |    8 ++++++++
 include/linux/namei.h |    3 +++
 2 files changed, 11 insertions(+)
fs/namei.c +8 -0
Index: linux-2.6.6/fs/namei.c
===================================================================
@@ -677,7 +677,9 @@
 
 		if (inode->i_op->follow_link) {
 			mntget(next.mnt);
+			nd->flags |= LOOKUP_LINK_NOTLAST;
 			err = do_follow_link(next.dentry, nd);
+			nd->flags &= ~LOOKUP_LINK_NOTLAST;
 			dput(next.dentry);
 			mntput(next.mnt);
 			if (err)
@@ -723,7 +725,9 @@
 			if (err < 0)
 				break;
 		}
+		nd->flags |= LOOKUP_LAST;
 		err = do_lookup(nd, &this, &next);
+		nd->flags &= ~LOOKUP_LAST;
 		if (err)
 			break;
 		follow_mount(&next.mnt, &next.dentry);
@@ -1344,7 +1348,9 @@
 	dir = nd->dentry;
 	nd->flags &= ~LOOKUP_PARENT;
 	down(&dir->d_inode->i_sem);
+	nd->flags |= LOOKUP_LAST;
 	dentry = __lookup_hash(&nd->last, nd->dentry, nd);
+	nd->flags &= ~LOOKUP_LAST;
 
 do_last:
 	error = PTR_ERR(dentry);
@@ -1449,7 +1455,9 @@
 	}
 	dir = nd->dentry;
 	down(&dir->d_inode->i_sem);
+	nd->flags |= LOOKUP_LAST;
 	dentry = __lookup_hash(&nd->last, nd->dentry, nd);
+	nd->flags &= ~LOOKUP_LAST;
 	putname(nd->last.name);
 	goto do_last;
 }
include/linux/namei.h +3 -0
Index: linux-2.6.6/include/linux/namei.h
===================================================================
@@ -70,6 +70,9 @@
 #define LOOKUP_CONTINUE		 4
 #define LOOKUP_PARENT		16
 #define LOOKUP_NOALT		32
+#define LOOKUP_LAST		64
+#define LOOKUP_LINK_NOTLAST	128
+
 /*
  * Intent data
  */