Skip to content
Snippets Groups Projects
Commit 54e5f7b9 authored by Johann Lombardi's avatar Johann Lombardi
Browse files

Branch b1_6

Re-add the following patches as per Andreas' request (on rmg@):

ldiskfs/kernel_patches/patches/ext3-check-jbd-errors-2.6-sles10.patch
ldiskfs/kernel_patches/patches/ext3-external-journal-2.6.9.patch
ldiskfs/kernel_patches/patches/ext3-statfs-2.6.18.patch
lustre/kernel_patches/patches/link_notlast-susefix.patch
lustre/kernel_patches/patches/vfs_nointent-2.6-sles10.patch
parent c4bc58c2
No related branches found
No related tags found
No related merge requests found
--- linux-2.6.5-7.141/fs/namei.c.orig 2005-04-01 18:03:37.788262784 +0300
+++ linux-2.6.5-7.141/fs/namei.c 2005-04-01 18:05:43.058218856 +0300
@@ -719,10 +719,12 @@
goto out_dput;
if (inode->i_op->follow_link) {
+ int save_flags = nd->flags;
mntget(next.mnt);
nd->flags |= LOOKUP_LINK_NOTLAST;
err = do_follow_link(next.dentry, nd);
- nd->flags &= ~LOOKUP_LINK_NOTLAST;
+ if (!(save_flags & LOOKUP_LINK_NOTLAST))
+ nd->flags &= ~LOOKUP_LINK_NOTLAST;
dput(next.dentry);
mntput(next.mnt);
if (err)
Index: linux-2.6.16.21-0.8/net/unix/af_unix.c
===================================================================
--- linux-2.6.16.21-0.8.orig/net/unix/af_unix.c 2006-08-03 01:34:33.000000000 -0600
+++ linux-2.6.16.21-0.8/net/unix/af_unix.c 2006-08-03 01:35:38.000000000 -0600
@@ -673,6 +673,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;
Index: linux-2.6.16.21-0.8/fs/open.c
===================================================================
--- linux-2.6.16.21-0.8.orig/fs/open.c 2006-08-03 01:34:33.000000000 -0600
+++ linux-2.6.16.21-0.8/fs/open.c 2006-08-03 02:54:31.000000000 -0600
@@ -197,9 +197,10 @@
}
int do_truncate(struct dentry *dentry, loff_t length, unsigned int time_attrs,
- struct file *filp)
+ struct file *filp, 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. */
@@ -214,7 +215,17 @@
}
mutex_lock(&dentry->d_inode->i_mutex);
- 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;
+ down_write(&dentry->d_inode->i_alloc_sem);
+ err = op->setattr_raw(dentry->d_inode, &newattrs);
+ up_write(&dentry->d_inode->i_alloc_sem);
+ } else
+ err = notify_change(dentry, &newattrs);
+
mutex_unlock(&dentry->d_inode->i_mutex);
return err;
}
@@ -269,7 +280,7 @@
error = locks_verify_truncate(inode, NULL, length);
if (!error) {
DQUOT_INIT(inode);
- error = do_truncate(nd.dentry, length, 0, NULL);
+ error = do_truncate(nd.dentry, length, 0, NULL, 0);
}
put_write_access(inode);
@@ -321,7 +332,7 @@
error = locks_verify_truncate(inode, file, length);
if (!error)
- error = do_truncate(dentry, length, 0, file);
+ error = do_truncate(dentry, length, 0, file, 0);
out_putf:
fput(file);
out:
@@ -406,9 +417,20 @@
(error = vfs_permission(&nd, MAY_WRITE)) != 0)
goto dput_and_out;
}
- mutex_lock(&inode->i_mutex);
- error = notify_change(nd.dentry, &newattrs);
- mutex_unlock(&inode->i_mutex);
+ 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 {
+ mutex_lock(&inode->i_mutex);
+ error = notify_change(nd.dentry, &newattrs);
+ mutex_unlock(&inode->i_mutex);
+ }
+
dput_and_out:
path_release(&nd);
out:
@@ -620,36 +642,52 @@
return error;
}
+int chmod_common(struct dentry *dentry, mode_t mode)
+{
+ struct inode * inode = dentry->d_inode;
+ struct iattr newattrs;
+ int error = -EROFS;
+
+ if (IS_RDONLY(inode))
+ goto out;
+
+ if (inode->i_op->setattr_raw) {
+ struct inode_operations *op = dentry->d_inode->i_op;
+
+ 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 normal vfs path now */
+ if (error != -EOPNOTSUPP)
+ goto out;
+ }
+
+ error = -EPERM;
+ if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
+ goto out;
+
+ mutex_lock(&inode->i_mutex);
+ 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(dentry, &newattrs);
+ mutex_unlock(&inode->i_mutex);
+out:
+ return error;
+}
+
asmlinkage long sys_fchmod(unsigned int fd, mode_t mode)
{
- struct inode * inode;
- struct dentry * dentry;
struct file * file;
int err = -EBADF;
- struct iattr newattrs;
file = fget(fd);
if (!file)
goto out;
- dentry = file->f_dentry;
- inode = dentry->d_inode;
-
- err = -EROFS;
- if (IS_RDONLY(inode))
- goto out_putf;
- err = -EPERM;
- if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
- goto out_putf;
- mutex_lock(&inode->i_mutex);
- 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);
- mutex_unlock(&inode->i_mutex);
-
-out_putf:
+ err = chmod_common(file->f_dentry, mode);
fput(file);
out:
return err;
@@ -659,32 +697,12 @@
mode_t mode)
{
struct nameidata nd;
- struct inode * inode;
int error;
- struct iattr newattrs;
error = __user_walk_fd(dfd, filename, LOOKUP_FOLLOW, &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;
-
- mutex_lock(&inode->i_mutex);
- 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);
- mutex_unlock(&inode->i_mutex);
-
-dput_and_out:
+ error = chmod_common(nd.dentry, mode);
path_release(&nd);
out:
return error;
@@ -710,6 +728,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;
Index: linux-2.6.16.21-0.8/fs/namei.c
===================================================================
--- linux-2.6.16.21-0.8.orig/fs/namei.c 2006-08-03 01:34:33.000000000 -0600
+++ linux-2.6.16.21-0.8/fs/namei.c 2006-08-03 02:54:31.000000000 -0600
@@ -1637,7 +1637,7 @@
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)
@@ -1911,6 +1911,7 @@
char * tmp;
struct dentry * dentry;
struct nameidata nd;
+ intent_init(&nd.intent, IT_LOOKUP);
if (S_ISDIR(mode))
return -EPERM;
@@ -1921,6 +1922,15 @@
error = do_path_lookup(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);
@@ -1947,6 +1957,7 @@
dput(dentry);
}
mutex_unlock(&nd.dentry->d_inode->i_mutex);
+out2:
path_release(&nd);
out:
putname(tmp);
@@ -1992,9 +2003,18 @@
struct dentry *dentry;
struct nameidata nd;
+ intent_init(&nd.intent, IT_LOOKUP);
error = do_path_lookup(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)) {
@@ -2004,6 +2024,7 @@
dput(dentry);
}
mutex_unlock(&nd.dentry->d_inode->i_mutex);
+out2:
path_release(&nd);
out:
putname(tmp);
@@ -2084,6 +2105,7 @@
char * name;
struct dentry *dentry;
struct nameidata nd;
+ intent_init(&nd.intent, IT_LOOKUP);
name = getname(pathname);
if(IS_ERR(name))
@@ -2104,6 +2126,14 @@
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);
@@ -2167,6 +2197,7 @@
struct dentry *dentry;
struct nameidata nd;
struct inode *inode = NULL;
+ intent_init(&nd.intent, IT_LOOKUP);
name = getname(pathname);
if(IS_ERR(name))
@@ -2178,6 +2209,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;
+ }
mutex_lock(&nd.dentry->d_inode->i_mutex);
dentry = lookup_hash(&nd);
error = PTR_ERR(dentry);
@@ -2260,9 +2298,17 @@
struct dentry *dentry;
struct nameidata nd;
+ intent_init(&nd.intent, IT_LOOKUP);
error = do_path_lookup(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)) {
@@ -2270,6 +2316,7 @@
dput(dentry);
}
mutex_unlock(&nd.dentry->d_inode->i_mutex);
+out2:
path_release(&nd);
out:
putname(to);
@@ -2357,6 +2404,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)) {
@@ -2533,6 +2587,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 = do_path_lookup(olddfd, oldname, LOOKUP_PARENT, &oldnd);
if (error)
@@ -2555,6 +2611,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);
@@ -2586,8 +2649,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.16.21-0.8/fs/exec.c
===================================================================
--- linux-2.6.16.21-0.8.orig/fs/exec.c 2006-08-03 01:34:33.000000000 -0600
+++ linux-2.6.16.21-0.8/fs/exec.c 2006-08-03 01:35:38.000000000 -0600
@@ -1524,7 +1524,7 @@
goto close_fail;
if (!file->f_op->write)
goto close_fail;
- if (do_truncate(file->f_dentry, 0, 0, file) != 0)
+ if (do_truncate(file->f_dentry, 0, 0, file, 0) != 0)
goto close_fail;
retval = binfmt->core_dump(signr, regs, file);
Index: linux-2.6.16.21-0.8/include/linux/fs.h
===================================================================
--- linux-2.6.16.21-0.8.orig/include/linux/fs.h 2006-08-03 01:34:33.000000000 -0600
+++ linux-2.6.16.21-0.8/include/linux/fs.h 2006-08-03 01:35:38.000000000 -0600
@@ -1041,13 +1041,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);
void * (*follow_link) (struct dentry *, struct nameidata *);
void (*put_link) (struct dentry *, struct nameidata *, void *);
@@ -1357,7 +1364,7 @@
/* fs/open.c */
extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs,
- struct file *filp);
+ struct file *filp, int called_from_open);
extern long do_sys_open(int fdf, const char __user *filename, int flags,
int mode);
extern struct file *filp_open(const char *, int, int);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment