⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vfs_intent-2.6-sles10.patch

📁 非常经典的一个分布式系统
💻 PATCH
📖 第 1 页 / 共 4 页
字号:
+	return __user_walk_fd_it(dfd, name, flags, nd);+}++int fastcall __user_walk_it(const char __user *name, unsigned flags, struct nameidata *nd)+{+	return __user_walk_fd_it(AT_FDCWD, name, flags, nd);+}+ int fastcall __user_walk(const char __user *name, unsigned flags, struct nameidata *nd) {-	return __user_walk_fd(AT_FDCWD, name, flags, nd);+	intent_init(&nd->intent, IT_LOOKUP);+	return __user_walk_it(name, flags, nd); }  /*@@ -1545,7 +1648,7 @@ int may_open(struct nameidata *nd, int a 		if (!error) { 			DQUOT_INIT(inode); 			-			error = do_truncate(dentry, 0, ATTR_MTIME|ATTR_CTIME, NULL);+			error = do_truncate(dentry, 0, ATTR_MTIME|ATTR_CTIME, NULL, 1); 		} 		put_write_access(inode); 		if (error)@@ -1595,7 +1698,7 @@ int open_namei(int dfd, const char *path 	 */ 	if (!(flag & O_CREAT)) { 		error = path_lookup_open(dfd, pathname, lookup_flags(flag),-					 nd, flag);+					 nd, flag, mode); 		if (error) 			return error; 		goto ok;@@ -1604,6 +1707,7 @@ int open_namei(int dfd, const char *path 	/* 	 * Create - we need to know the parent. 	 */+ 	nd->intent.it_op |= IT_CREAT; 	error = path_lookup_create(dfd,pathname,LOOKUP_PARENT,nd,flag,mode); 	if (error) 		return error;@@ -1620,7 +1724,9 @@ int open_namei(int dfd, const char *path 	dir = nd->dentry; 	nd->flags &= ~LOOKUP_PARENT; 	mutex_lock(&dir->d_inode->i_mutex);+	nd->flags |= LOOKUP_LAST; 	path.dentry = lookup_hash(nd);+	nd->flags &= ~LOOKUP_LAST; 	path.mnt = nd->mnt;  do_last:@@ -1630,9 +1736,9 @@ do_last: 		goto exit; 	} -	if (IS_ERR(nd->intent.open.file)) {+	if (IS_ERR(nd->intent.file)) { 		mutex_unlock(&dir->d_inode->i_mutex);-		error = PTR_ERR(nd->intent.open.file);+		error = PTR_ERR(nd->intent.file); 		goto exit_dput; 	} @@ -1687,7 +1793,7 @@ ok: exit_dput: 	dput_path(&path, nd); exit:-	if (!IS_ERR(nd->intent.open.file))+	if (!IS_ERR(nd->intent.file)) 		release_open_intent(nd); 	path_release(nd); 	return error;@@ -1736,7 +1842,9 @@ do_link: 	} 	dir = nd->dentry; 	mutex_lock(&dir->d_inode->i_mutex);+	nd->flags |= LOOKUP_LAST; 	path.dentry = lookup_hash(nd);+	nd->flags &= ~LOOKUP_LAST; 	path.mnt = nd->mnt; 	__putname(nd->last.name); 	goto do_last;@@ -1821,15 +1929,26 @@ asmlinkage long sys_mknodat(int dfd, con 	struct dentry * dentry; 	struct nameidata nd; + 	if (S_ISDIR(mode)) 		return -EPERM; 	tmp = getname(filename); 	if (IS_ERR(tmp)) 		return PTR_ERR(tmp); -	error = do_path_lookup(dfd, tmp, LOOKUP_PARENT, &nd);+	intent_init(&nd.intent, IT_LOOKUP);+	error = do_path_lookup_it(dfd, tmp, LOOKUP_PARENT, &nd); 	if (error) 		goto out;++	if (nd.dentry->d_inode->i_op->mknod_raw) {+		struct inode_operations *op = nd.dentry->d_inode->i_op;+		error = op->mknod_raw(&nd, mode, dev);+		/* the file system wants to use normal vfs path now */+		if (error != -EOPNOTSUPP)+			goto out2;+	}+ 	dentry = lookup_create(&nd, 0); 	error = PTR_ERR(dentry); @@ -1856,6 +1975,7 @@ asmlinkage long sys_mknodat(int dfd, con 		dput(dentry); 	} 	mutex_unlock(&nd.dentry->d_inode->i_mutex);+out2: 	path_release(&nd); out: 	putname(tmp);@@ -1901,9 +2021,18 @@ asmlinkage long sys_mkdirat(int dfd, con 		struct dentry *dentry; 		struct nameidata nd; -		error = do_path_lookup(dfd, tmp, LOOKUP_PARENT, &nd);+ 		intent_init(&nd.intent, IT_LOOKUP);+		error = do_path_lookup_it(dfd, tmp, LOOKUP_PARENT, &nd); 		if (error) 			goto out;+ 		if (nd.dentry->d_inode->i_op->mkdir_raw) {+ 			struct inode_operations *op = nd.dentry->d_inode->i_op;+ 			error = op->mkdir_raw(&nd, mode);+ 			/* the file system wants to use normal vfs path now */+ 			if (error != -EOPNOTSUPP)+ 				goto out2;+ 		}+ 		dentry = lookup_create(&nd, 1); 		error = PTR_ERR(dentry); 		if (!IS_ERR(dentry)) {@@ -1913,6 +2042,7 @@ asmlinkage long sys_mkdirat(int dfd, con 			dput(dentry); 		} 		mutex_unlock(&nd.dentry->d_inode->i_mutex);+out2: 		path_release(&nd); out: 		putname(tmp);@@ -1997,8 +2127,9 @@ static long do_rmdir(int dfd, const char 	name = getname(pathname); 	if(IS_ERR(name)) 		return PTR_ERR(name);--	error = do_path_lookup(dfd, name, LOOKUP_PARENT, &nd);+		+	intent_init(&nd.intent, IT_LOOKUP);+	error = do_path_lookup_it(dfd, name, LOOKUP_PARENT, &nd); 	if (error) 		goto exit; @@ -2013,6 +2144,14 @@ static long do_rmdir(int dfd, const char 			error = -EBUSY; 			goto exit1; 	}+	if (nd.dentry->d_inode->i_op->rmdir_raw) {+                struct inode_operations *op = nd.dentry->d_inode->i_op;++                error = op->rmdir_raw(&nd);+                /* the file system wants to use normal vfs path now */+                if (error != -EOPNOTSUPP)+                        goto exit1;+        } 	mutex_lock(&nd.dentry->d_inode->i_mutex); 	dentry = lookup_hash(&nd); 	error = PTR_ERR(dentry);@@ -2081,12 +2220,20 @@ static long do_unlinkat(int dfd, const c 	if(IS_ERR(name)) 		return PTR_ERR(name); -	error = do_path_lookup(dfd, name, LOOKUP_PARENT, &nd);+	intent_init(&nd.intent, IT_LOOKUP);+	error = do_path_lookup_it(dfd, name, LOOKUP_PARENT, &nd); 	if (error) 		goto exit; 	error = -EISDIR; 	if (nd.last_type != LAST_NORM) 		goto exit1;+	if (nd.dentry->d_inode->i_op->unlink_raw) {+        	struct inode_operations *op = nd.dentry->d_inode->i_op;+        	error = op->unlink_raw(&nd);+                /* the file system wants to use normal vfs path now */+        	if (error != -EOPNOTSUPP)+                       goto exit1;+        } 	mutex_lock(&nd.dentry->d_inode->i_mutex); 	dentry = lookup_hash(&nd); 	error = PTR_ERR(dentry);@@ -2169,9 +2316,17 @@ asmlinkage long sys_symlinkat(const char 		struct dentry *dentry; 		struct nameidata nd; -		error = do_path_lookup(newdfd, to, LOOKUP_PARENT, &nd);+ 		intent_init(&nd.intent, IT_LOOKUP);+		error = do_path_lookup_it(newdfd, to, LOOKUP_PARENT, &nd); 		if (error) 			goto out;+		if (nd.dentry->d_inode->i_op->symlink_raw) {+			struct inode_operations *op = nd.dentry->d_inode->i_op;+ 			error = op->symlink_raw(&nd, from);+ 			/* the file system wants to use normal vfs path now */+ 			if (error != -EOPNOTSUPP)+ 				goto out2;+ 		} 		dentry = lookup_create(&nd, 0); 		error = PTR_ERR(dentry); 		if (!IS_ERR(dentry)) {@@ -2179,6 +2334,7 @@ asmlinkage long sys_symlinkat(const char 			dput(dentry); 		} 		mutex_unlock(&nd.dentry->d_inode->i_mutex);+out2: 		path_release(&nd); out: 		putname(to);@@ -2255,15 +2411,25 @@ asmlinkage long sys_linkat(int olddfd, c 	if (IS_ERR(to)) 		return PTR_ERR(to); -	error = __user_walk_fd(olddfd, oldname, 0, &old_nd);+        intent_init(&old_nd.intent, IT_LOOKUP);+	error = __user_walk_fd_it(olddfd, oldname, 0, &old_nd); 	if (error) 		goto exit;-	error = do_path_lookup(newdfd, to, LOOKUP_PARENT, &nd);+		+	intent_init(&nd.intent, IT_LOOKUP);		+	error = do_path_lookup_it(newdfd, to, LOOKUP_PARENT, &nd); 	if (error) 		goto out; 	error = -EXDEV; 	if (old_nd.mnt != nd.mnt) 		goto out_release;+	if (nd.dentry->d_inode->i_op->link_raw) {+		struct inode_operations *op = nd.dentry->d_inode->i_op;+		error = op->link_raw(&old_nd, &nd);+		/* the file system wants to use normal vfs path now */+		if (error != -EOPNOTSUPP)+			goto out_release;+	} 	new_dentry = lookup_create(&nd, 0); 	error = PTR_ERR(new_dentry); 	if (!IS_ERR(new_dentry)) {@@ -2440,12 +2606,14 @@ static int do_rename(int olddfd, const c 	struct dentry * old_dentry, *new_dentry; 	struct dentry * trap; 	struct nameidata oldnd, newnd;--	error = do_path_lookup(olddfd, oldname, LOOKUP_PARENT, &oldnd);+	+	intent_init(&oldnd.intent, IT_LOOKUP);+	error = do_path_lookup_it(olddfd, oldname, LOOKUP_PARENT, &oldnd); 	if (error) 		goto exit;--	error = do_path_lookup(newdfd, newname, LOOKUP_PARENT, &newnd);+		+	intent_init(&newnd.intent, IT_LOOKUP);+	error = do_path_lookup_it(newdfd, newname, LOOKUP_PARENT, &newnd); 	if (error) 		goto exit1; @@ -2462,6 +2630,13 @@ static int do_rename(int olddfd, const c 	if (newnd.last_type != LAST_NORM) 		goto exit2; +	if (old_dir->d_inode->i_op->rename_raw) {+		error = old_dir->d_inode->i_op->rename_raw(&oldnd, &newnd);+		/* the file system wants to use normal vfs path now */+		if (error != -EOPNOTSUPP)+			goto exit2;+	}+ 	trap = lock_rename(new_dir, old_dir);  	old_dentry = lookup_hash(&oldnd);@@ -2493,8 +2668,7 @@ static int do_rename(int olddfd, const c 	if (new_dentry == trap) 		goto exit5; -	error = vfs_rename(old_dir->d_inode, old_dentry,-				   new_dir->d_inode, new_dentry);+	error = vfs_rename(old_dir->d_inode, old_dentry, new_dir->d_inode, new_dentry); exit5: 	dput(new_dentry); exit4:@@ -2700,6 +2874,7 @@ EXPORT_SYMBOL(__page_symlink); EXPORT_SYMBOL(page_symlink); EXPORT_SYMBOL(page_symlink_inode_operations); EXPORT_SYMBOL(path_lookup);+EXPORT_SYMBOL(path_lookup_it); EXPORT_SYMBOL(path_release); EXPORT_SYMBOL(path_walk); EXPORT_SYMBOL(permission);Index: LINUX-SRC-TREE/fs/namespace.c===================================================================--- LINUX-SRC-TREE.orig/fs/namespace.c+++ LINUX-SRC-TREE/fs/namespace.c@@ -75,6 +75,7 @@ struct vfsmount *alloc_vfsmnt(const char 		INIT_LIST_HEAD(&mnt->mnt_share); 		INIT_LIST_HEAD(&mnt->mnt_slave_list); 		INIT_LIST_HEAD(&mnt->mnt_slave);+		INIT_LIST_HEAD(&mnt->mnt_lustre_list); 		if (name) { 			int size = strlen(name) + 1; 			char *newname = kmalloc(size, GFP_KERNEL);@@ -155,6 +156,7 @@ static void __touch_namespace(struct nam  static void detach_mnt(struct vfsmount *mnt, struct nameidata *old_nd) {+	memset(old_nd, 0, sizeof(*old_nd)); 	old_nd->dentry = mnt->mnt_mountpoint; 	old_nd->mnt = mnt->mnt_parent; 	mnt->mnt_parent = mnt;@@ -273,6 +275,9 @@ static inline void __mntput(struct vfsmo { 	struct super_block *sb = mnt->mnt_sb; 	dput(mnt->mnt_root);+	spin_lock(&dcache_lock);+	list_del(&mnt->mnt_lustre_list);+	spin_unlock(&dcache_lock); 	free_vfsmnt(mnt); 	deactivate_super(sb); }@@ -539,6 +544,8 @@ static int do_umount(struct vfsmount *mn 	 */  	lock_kernel();+ 	if (sb->s_op->umount_lustre)+ 		sb->s_op->umount_lustre(sb); 	if ((flags & MNT_FORCE) && sb->s_op->umount_begin) 		sb->s_op->umount_begin(sb); 	unlock_kernel();@@ -871,7 +878,8 @@ static int do_loopback(struct nameidata  		return err; 	if (!old_name || !*old_name) 		return -EINVAL;-	err = path_lookup(old_name, LOOKUP_FOLLOW, &old_nd);+	intent_init(&old_nd.intent, IT_LOOKUP);+	err = path_lookup_it(old_name, LOOKUP_FOLLOW, &old_nd); 	if (err) 		return err; @@ -956,7 +964,8 @@ static int do_move_mount(struct nameidat 		return -EPERM; 	if (!old_name || !*old_name) 		return -EINVAL;-	err = path_lookup(old_name, LOOKUP_FOLLOW, &old_nd);+	intent_init(&old_nd.intent, IT_LOOKUP);+	err = path_lookup_it(old_name, LOOKUP_FOLLOW, &old_nd); 	if (err) 		return err; @@ -1271,6 +1280,7 @@ long do_mount(char *dev_name, char *dir_ 	int retval = 0; 	int mnt_flags = 0; + 	/* Discard magic */ 	if ((flags & MS_MGC_MSK) == MS_MGC_VAL) 		flags &= ~MS_MGC_MSK;@@ -1301,7 +1311,8 @@ long do_mount(char *dev_name, char *dir_ 		   MS_NOATIME | MS_NODIRATIME);  	/* ... and get the mountpoint */-	retval = path_lookup(dir_name, LOOKUP_FOLLOW, &nd);+	intent_init(&nd.intent, IT_LOOKUP);	+	retval = path_lookup_it(dir_name, LOOKUP_FOLLOW, &nd);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -