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

📄 vfs_nointent-2.6-rhel4.patch

📁 lustre 1.6.5 source code
💻 PATCH
字号:
Index: linux-2.6.9-5.0.3.EL/fs/namei.c===================================================================--- linux-2.6.9-5.0.3.EL.orig/fs/namei.c	2005-02-26 13:29:11.948782168 +0200+++ linux-2.6.9-5.0.3.EL/fs/namei.c	2005-02-26 13:29:13.355568304 +0200@@ -1380,7 +1380,7 @@ 		if (!error) { 			DQUOT_INIT(inode); 			-			error = do_truncate(dentry, 0);+			error = do_truncate(dentry, 0, 1); 		} 		put_write_access(inode); 		if (error)@@ -1638,6 +1638,7 @@ 	char * tmp; 	struct dentry * dentry; 	struct nameidata nd;+	intent_init(&nd.intent, IT_LOOKUP);  	if (S_ISDIR(mode)) 		return -EPERM;@@ -1648,6 +1649,15 @@ 	error = path_lookup(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); @@ -1674,6 +1684,7 @@ 		dput(dentry); 	} 	up(&nd.dentry->d_inode->i_sem);+out2: 	path_release(&nd); out: 	putname(tmp);@@ -1715,10 +1726,18 @@ 	if (!IS_ERR(tmp)) { 		struct dentry *dentry; 		struct nameidata nd;+		intent_init(&nd.intent, IT_LOOKUP);  		error = path_lookup(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)) {@@ -1728,6 +1747,7 @@ 			dput(dentry); 		} 		up(&nd.dentry->d_inode->i_sem);+out2: 		path_release(&nd); out: 		putname(tmp);@@ -1808,6 +1828,7 @@ 	char * name; 	struct dentry *dentry; 	struct nameidata nd;+	intent_init(&nd.intent, IT_LOOKUP);  	name = getname(pathname); 	if(IS_ERR(name))@@ -1828,6 +1849,16 @@ 			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;+	}+ 	down(&nd.dentry->d_inode->i_sem); 	dentry = lookup_hash(&nd.last, nd.dentry); 	error = PTR_ERR(dentry);@@ -1886,6 +1917,7 @@ 	struct dentry *dentry; 	struct nameidata nd; 	struct inode *inode = NULL;+	intent_init(&nd.intent, IT_LOOKUP);  	name = getname(pathname); 	if(IS_ERR(name))@@ -1897,6 +1929,13 @@ 	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;+	} 	down(&nd.dentry->d_inode->i_sem); 	dentry = lookup_hash(&nd.last, nd.dentry); 	error = PTR_ERR(dentry);@@ -1963,10 +2002,18 @@ 	if (!IS_ERR(to)) { 		struct dentry *dentry; 		struct nameidata nd;+		intent_init(&nd.intent, IT_LOOKUP);  		error = path_lookup(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)) {@@ -1974,6 +2021,7 @@ 			dput(dentry); 		} 		up(&nd.dentry->d_inode->i_sem);+out2: 		path_release(&nd); out: 		putname(to);@@ -2037,6 +2085,8 @@ 	struct nameidata nd, old_nd; 	int error; 	char * to;+	intent_init(&nd.intent, IT_LOOKUP);+	intent_init(&old_nd.intent, IT_LOOKUP);  	to = getname(newname); 	if (IS_ERR(to))@@ -2051,6 +2101,13 @@ 	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)) {@@ -2223,6 +2280,8 @@ 	struct dentry * old_dentry, *new_dentry; 	struct dentry * trap; 	struct nameidata oldnd, newnd;+	intent_init(&oldnd.intent, IT_LOOKUP);+	intent_init(&newnd.intent, IT_LOOKUP);  	error = path_lookup(oldname, LOOKUP_PARENT, &oldnd); 	if (error)@@ -2245,6 +2304,13 @@ 	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.last, old_dir);@@ -2276,8 +2342,7 @@ 	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:Index: linux-2.6.9-5.0.3.EL/fs/open.c===================================================================--- linux-2.6.9-5.0.3.EL.orig/fs/open.c	2005-02-26 13:29:11.962780040 +0200+++ linux-2.6.9-5.0.3.EL/fs/open.c	2005-02-26 13:29:13.359567696 +0200@@ -191,9 +191,10 @@ 	return error; } -int do_truncate(struct dentry *dentry, loff_t length)+int do_truncate(struct dentry *dentry, loff_t length, int called_from_open) { 	int err;+	struct inode_operations *op = dentry->d_inode->i_op; 	struct iattr newattrs;  	/* Not pretty: "inode->i_size" shouldn't really be signed. But it is. */@@ -204,7 +205,14 @@ 	newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME; 	down(&dentry->d_inode->i_sem); 	down_write(&dentry->d_inode->i_alloc_sem);-	err = notify_change(dentry, &newattrs);+	if (called_from_open)+		newattrs.ia_valid |= ATTR_FROM_OPEN;+	if (op->setattr_raw) {+		newattrs.ia_valid |= ATTR_RAW;+		newattrs.ia_ctime = CURRENT_TIME;+		err = op->setattr_raw(dentry->d_inode, &newattrs);+	} else+		err = notify_change(dentry, &newattrs); 	up_write(&dentry->d_inode->i_alloc_sem); 	up(&dentry->d_inode->i_sem); 	return err;@@ -260,7 +268,7 @@ 	error = locks_verify_truncate(inode, NULL, length); 	if (!error) { 		DQUOT_INIT(inode);-		error = do_truncate(nd.dentry, length);+		error = do_truncate(nd.dentry, length, 0); 	} 	put_write_access(inode); @@ -312,7 +320,7 @@  	error = locks_verify_truncate(inode, file, length); 	if (!error)-		error = do_truncate(dentry, length);+		error = do_truncate(dentry, length, 0); out_putf: 	fput(file); out:@@ -391,9 +399,19 @@ 		    (error = permission(inode,MAY_WRITE,&nd)) != 0) 			goto dput_and_out; 	}-	down(&inode->i_sem);-	error = notify_change(nd.dentry, &newattrs);-	up(&inode->i_sem);+	if (inode->i_op->setattr_raw) {+		struct inode_operations *op = nd.dentry->d_inode->i_op;++		newattrs.ia_valid |= ATTR_RAW;+		error = op->setattr_raw(inode, &newattrs);+		/* the file system wants to use normal vfs path now */+		if (error != -EOPNOTSUPP)+			goto dput_and_out;+	} else {+		down(&inode->i_sem);+		error = notify_change(nd.dentry, &newattrs);+		up(&inode->i_sem);+	} dput_and_out: 	path_release(&nd); out:@@ -444,9 +462,19 @@ 		    (error = permission(inode,MAY_WRITE,&nd)) != 0) 			goto dput_and_out; 	}-	down(&inode->i_sem);-	error = notify_change(nd.dentry, &newattrs);-	up(&inode->i_sem);+	if (inode->i_op->setattr_raw) {+		struct inode_operations *op = nd.dentry->d_inode->i_op;++		newattrs.ia_valid |= ATTR_RAW;+		error = op->setattr_raw(inode, &newattrs);+		/* the file system wants to use normal vfs path now */+		if (error != -EOPNOTSUPP)+			goto dput_and_out;+	} else {+		down(&inode->i_sem);+		error = notify_change(nd.dentry, &newattrs);+		up(&inode->i_sem);+	} dput_and_out: 	path_release(&nd); out:@@ -600,36 +628,52 @@  EXPORT_SYMBOL_GPL(sys_chroot); -asmlinkage long sys_fchmod(unsigned int fd, mode_t mode)+int chmod_common(struct dentry *dentry, mode_t mode) {-	struct inode * inode;-	struct dentry * dentry;-	struct file * file;-	int err = -EBADF;+	struct inode * inode = dentry->d_inode; 	struct iattr newattrs;+	int error = -EROFS; -	file = fget(fd);-	if (!file)+	if (IS_RDONLY(inode)) 		goto out;+	+	if (inode->i_op->setattr_raw) {+		struct inode_operations *op = dentry->d_inode->i_op; -	dentry = file->f_dentry;-	inode = dentry->d_inode;+		newattrs.ia_mode = mode;+		newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;+		newattrs.ia_valid |= ATTR_RAW;+		error = op->setattr_raw(inode, &newattrs);+		/* the file system wants to use the normal vfs path now */+		if (error != -EOPNOTSUPP)+			goto out;+	} -	err = -EROFS;-	if (IS_RDONLY(inode))-		goto out_putf;-	err = -EPERM;+	error = -EPERM; 	if (IS_IMMUTABLE(inode) || IS_APPEND(inode))-		goto out_putf;+		goto out;+ 	down(&inode->i_sem); 	if (mode == (mode_t) -1) 		mode = inode->i_mode; 	newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO); 	newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;-	err = notify_change(dentry, &newattrs);+	error = notify_change(dentry, &newattrs); 	up(&inode->i_sem);+out:+	return error;+} -out_putf:+asmlinkage long sys_fchmod(unsigned int fd, mode_t mode)+{+	struct file * file;+	int err = -EBADF;++	file = fget(fd);+	if (!file)+		goto out;++	err = chmod_common(file->f_dentry, mode); 	fput(file); out: 	return err;@@ -638,32 +682,13 @@ asmlinkage long sys_chmod(const char __user * filename, mode_t mode) { 	struct nameidata nd;-	struct inode * inode; 	int error;-	struct iattr newattrs;  	error = user_path_walk(filename, &nd); 	if (error) 		goto out;-	inode = nd.dentry->d_inode;--	error = -EROFS;-	if (IS_RDONLY(inode))-		goto dput_and_out;--	error = -EPERM;-	if (IS_IMMUTABLE(inode) || IS_APPEND(inode))-		goto dput_and_out;--	down(&inode->i_sem);-	if (mode == (mode_t) -1)-		mode = inode->i_mode;-	newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);-	newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;-	error = notify_change(nd.dentry, &newattrs);-	up(&inode->i_sem); -dput_and_out:+	error = chmod_common(nd.dentry, mode); 	path_release(&nd); out: 	return error;@@ -684,6 +709,18 @@ 	if (IS_RDONLY(inode)) 		goto out; 	error = -EPERM;+	if (inode->i_op->setattr_raw) {+		struct inode_operations *op = dentry->d_inode->i_op;++		newattrs.ia_uid = user;+		newattrs.ia_gid = group;+		newattrs.ia_valid = ATTR_UID | ATTR_GID | ATTR_CTIME;+		newattrs.ia_valid |= ATTR_RAW;+		error = op->setattr_raw(inode, &newattrs);+		/* the file system wants to use normal vfs path now */+		if (error != -EOPNOTSUPP)+			return error;+	} 	if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) 		goto out; 	newattrs.ia_valid =  ATTR_CTIME;@@ -697,6 +734,7 @@ 	} 	if (!S_ISDIR(inode->i_mode)) 		newattrs.ia_valid |= ATTR_KILL_SUID|ATTR_KILL_SGID;+ 	down(&inode->i_sem); 	error = notify_change(dentry, &newattrs); 	up(&inode->i_sem);Index: linux-2.6.9-5.0.3.EL/fs/exec.c===================================================================--- linux-2.6.9-5.0.3.EL.orig/fs/exec.c	2005-02-26 13:29:11.936783992 +0200+++ linux-2.6.9-5.0.3.EL/fs/exec.c	2005-02-26 13:29:13.362567240 +0200@@ -1451,7 +1451,7 @@ 		goto close_fail; 	if (!file->f_op->write) 		goto close_fail;-	if (do_truncate(file->f_dentry, 0) != 0)+	if (do_truncate(file->f_dentry, 0, 0) != 0) 		goto close_fail;  	retval = binfmt->core_dump(signr, regs, file);Index: linux-2.6.9-5.0.3.EL/include/linux/fs.h===================================================================--- linux-2.6.9-5.0.3.EL.orig/include/linux/fs.h	2005-02-26 13:29:11.987776240 +0200+++ linux-2.6.9-5.0.3.EL/include/linux/fs.h	2005-02-26 13:29:13.365566784 +0200@@ -926,13 +926,20 @@ 	int (*create) (struct inode *,struct dentry *,int, struct nameidata *); 	struct dentry * (*lookup) (struct inode *,struct dentry *, struct nameidata *); 	int (*link) (struct dentry *,struct inode *,struct dentry *);+	int (*link_raw) (struct nameidata *,struct nameidata *); 	int (*unlink) (struct inode *,struct dentry *);+	int (*unlink_raw) (struct nameidata *); 	int (*symlink) (struct inode *,struct dentry *,const char *);+	int (*symlink_raw) (struct nameidata *,const char *); 	int (*mkdir) (struct inode *,struct dentry *,int);+	int (*mkdir_raw) (struct nameidata *,int); 	int (*rmdir) (struct inode *,struct dentry *);+	int (*rmdir_raw) (struct nameidata *); 	int (*mknod) (struct inode *,struct dentry *,int,dev_t);+	int (*mknod_raw) (struct nameidata *,int,dev_t); 	int (*rename) (struct inode *, struct dentry *, 			struct inode *, struct dentry *);+	int (*rename_raw) (struct nameidata *, struct nameidata *); 	int (*readlink) (struct dentry *, char __user *,int); 	int (*follow_link) (struct dentry *, struct nameidata *); 	void (*put_link) (struct dentry *, struct nameidata *);@@ -1234,7 +1241,7 @@  /* fs/open.c */ -extern int do_truncate(struct dentry *, loff_t start);+extern int do_truncate(struct dentry *, loff_t start, int called_from_open); extern struct file *filp_open(const char *, int, int); extern struct file * dentry_open(struct dentry *, struct vfsmount *, int); extern struct file * dentry_open_it(struct dentry *, struct vfsmount *, int, struct lookup_intent *);Index: linux-2.6.9-5.0.3.EL/net/unix/af_unix.c===================================================================--- linux-2.6.9-5.0.3.EL.orig/net/unix/af_unix.c	2005-02-25 10:25:31.000000000 +0200+++ linux-2.6.9-5.0.3.EL/net/unix/af_unix.c	2005-02-26 13:29:13.387563440 +0200@@ -676,6 +676,7 @@ 	int err = 0; 	 	if (sunname->sun_path[0]) {+		intent_init(&nd.intent, IT_LOOKUP); 		err = path_lookup(sunname->sun_path, LOOKUP_FOLLOW, &nd); 		if (err) 			goto fail;

⌨️ 快捷键说明

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