xfs
[Top] [All Lists]

patch 2.6.30 and 2.6.30.1 xfs/nfs oops fix, radix tree

To: xfs <xfs@xxxxxxxxxxx>
Subject: patch 2.6.30 and 2.6.30.1 xfs/nfs oops fix, radix tree
From: Michael Ole Olsen <gnu@xxxxxxx>
Date: Tue, 21 Jul 2009 03:24:55 +0200
User-agent: Mutt/1.5.18 (2008-05-17)
Eric has been very helpful in helping me downgrade xfs in 2.6.30.1 to 2.6.28.7
version (getting 2.6.28.7 to compile in 2.6.30.1) which removed the oopses.

Just wanted to post here for other people like me that don't have an option
of downgrading their kernel (need i.e. mdadm>=2.6.30).

for those that use special features of i.e. mdadm for raid which requires at
least 2.6.30 to assemble the raid6 with Q blocks on the last disk i.e. this is
about the only option.

Xfs seems to oops all the time in >=2.6.30 on my boxes with radix tree trace, 
that is why the downgrade was made.

I havn't had a single issue since downgrading which is a few days ago now,
before I used to get up to 3-4 oopses a day in 2.6.30 or 2.6.30.1 with
nfs+xfs and lots of npd!=np in dmesg which are now gone

Here is the patch that I got from him that fixes the oopses in >=2.6.30 with
nfs, I will be adding it to the bugzilla as well until the real bug is fixed
http://bugzilla.kernel.org/show_bug.cgi?id=13375

The patch is simply the 2.6.28.7 xfs code, modified to compile on 2.6.30
and 2.6.30.1 , no guarantees (although I have extensively tested for some days
now without problems whatsoever).

# author eric @ xfs.org
# fixes xfs radix tree oopses in 2.6.30 and 2.6.30.1 with nfs kernel server
# and also perhaps selinux oopses (nfs_setuid) as well (havn't tested)
# this patch is based on linux 2.6.28.7 xfs kernel code,
# and should only be needed if you need kernel code from
# 2.6.30 but xfs keeps oopsing in that kernel, i.e. mdadm from >=2.6.30 kernel
Index: linux-2.6.28.7/fs/xfs/linux-2.6/xfs_cred.h
===================================================================
--- linux-2.6.28.7.orig/fs/xfs/linux-2.6/xfs_cred.h
+++ linux-2.6.28.7/fs/xfs/linux-2.6/xfs_cred.h
@@ -23,9 +23,7 @@
 /*
  * Credentials
  */
-typedef struct cred {
-       /* EMPTY */
-} cred_t;
+typedef struct cred cred_t;

 extern struct cred *sys_cred;

Index: linux-2.6.28.7/fs/xfs/xfs_acl.c
===================================================================
--- linux-2.6.28.7.orig/fs/xfs/xfs_acl.c
+++ linux-2.6.28.7/fs/xfs/xfs_acl.c
@@ -366,7 +366,7 @@ xfs_acl_allow_set(
                return ENOTDIR;
        if (vp->i_sb->s_flags & MS_RDONLY)
                return EROFS;
-       if (XFS_I(vp)->i_d.di_uid != current->fsuid && !capable(CAP_FOWNER))
+       if (XFS_I(vp)->i_d.di_uid != current_fsuid() && !capable(CAP_FOWNER))
                return EPERM;
        return 0;
 }
@@ -413,13 +413,13 @@ xfs_acl_access(
                switch (fap->acl_entry[i].ae_tag) {
                case ACL_USER_OBJ:
                        seen_userobj = 1;
-                       if (fuid != current->fsuid)
+                       if (fuid != current_fsuid())
                                continue;
                        matched.ae_tag = ACL_USER_OBJ;
                        matched.ae_perm = allows;
                        break;
                case ACL_USER:
-                       if (fap->acl_entry[i].ae_id != current->fsuid)
+                       if (fap->acl_entry[i].ae_id != current_fsuid())
                                continue;
                        matched.ae_tag = ACL_USER;
                        matched.ae_perm = allows;
Index: linux-2.6.28.7/fs/xfs/linux-2.6/xfs_ioctl.c
===================================================================
--- linux-2.6.28.7.orig/fs/xfs/linux-2.6/xfs_ioctl.c
+++ linux-2.6.28.7/fs/xfs/linux-2.6/xfs_ioctl.c
@@ -256,6 +256,7 @@ xfs_open_by_handle(
        struct file             *parfilp,
        struct inode            *parinode)
 {
+       const struct cred       *cred = current_cred();
        int                     error;
        int                     new_fd;
        int                     permflag;
@@ -321,7 +322,7 @@ xfs_open_by_handle(
        mntget(parfilp->f_path.mnt);

        /* Create file pointer. */
-       filp = dentry_open(dentry, parfilp->f_path.mnt, hreq.oflags);
+       filp = dentry_open(dentry, parfilp->f_path.mnt, hreq.oflags, cred);
        if (IS_ERR(filp)) {
                put_unused_fd(new_fd);
                return -XFS_ERROR(-PTR_ERR(filp));
@@ -1007,7 +1008,7 @@ xfs_ioctl_setattr(
         * to the file owner ID, except in cases where the
         * CAP_FSETID capability is applicable.
         */
-       if (current->fsuid != ip->i_d.di_uid && !capable(CAP_FOWNER)) {
+       if (current_fsuid() != ip->i_d.di_uid && !capable(CAP_FOWNER)) {
                code = XFS_ERROR(EPERM);
                goto error_return;
        }
Index: linux-2.6.28.7/fs/xfs/linux-2.6/xfs_iops.c
===================================================================
--- linux-2.6.28.7.orig/fs/xfs/linux-2.6/xfs_iops.c
+++ linux-2.6.28.7/fs/xfs/linux-2.6/xfs_iops.c
@@ -228,7 +228,7 @@ xfs_vn_mknod(
        xfs_dentry_to_name(&name, dentry);

        if (IS_POSIXACL(dir) && !default_acl)
-               mode &= ~current->fs->umask;
+               mode &= ~current_umask();

        switch (mode & S_IFMT) {
        case S_IFCHR:
@@ -422,7 +422,7 @@ xfs_vn_symlink(
        mode_t          mode;

        mode = S_IFLNK |
-               (irix_symlink_mode ? 0777 & ~current->fs->umask : S_IRWXUGO);
+               (irix_symlink_mode ? 0777 & ~current_umask() : S_IRWXUGO);
        xfs_dentry_to_name(&name, dentry);

        error = xfs_symlink(XFS_I(dir), &name, symname, mode, &cip, NULL);
Index: linux-2.6.28.7/fs/xfs/linux-2.6/xfs_super.c
===================================================================
--- linux-2.6.28.7.orig/fs/xfs/linux-2.6/xfs_super.c
+++ linux-2.6.28.7/fs/xfs/linux-2.6/xfs_super.c
@@ -1351,14 +1351,15 @@ xfs_fs_remount(
  * need to take care of themetadata. Once that's done write a dummy
  * record to dirty the log in case of a crash while frozen.
  */
-STATIC void
-xfs_fs_lockfs(
+STATIC int
+xfs_fs_freeze(
        struct super_block      *sb)
 {
        struct xfs_mount        *mp = XFS_M(sb);

        xfs_attr_quiesce(mp);
        xfs_fs_log_dummy(mp);
+       return 0;
 }

 STATIC int
@@ -1847,7 +1848,7 @@ static struct super_operations xfs_super
        .put_super              = xfs_fs_put_super,
        .write_super            = xfs_fs_write_super,
        .sync_fs                = xfs_fs_sync_super,
-       .write_super_lockfs     = xfs_fs_lockfs,
+       .freeze_fs              = xfs_fs_freeze,
        .statfs                 = xfs_fs_statfs,
        .remount_fs             = xfs_fs_remount,
        .show_options           = xfs_fs_show_options,
Index: linux-2.6.28.7/fs/xfs/linux-2.6/xfs_file.c
===================================================================
--- linux-2.6.28.7.orig/fs/xfs/linux-2.6/xfs_file.c
+++ linux-2.6.28.7/fs/xfs/linux-2.6/xfs_file.c
@@ -299,9 +299,9 @@ xfs_file_ioctl_invis(
 STATIC int
 xfs_vm_page_mkwrite(
        struct vm_area_struct   *vma,
-       struct page             *page)
+       struct vm_fault         *vmf)
 {
-       return block_page_mkwrite(vma, page, xfs_get_blocks);
+       return block_page_mkwrite(vma, vmf, xfs_get_blocks);
 }

 const struct file_operations xfs_file_operations = {

Attachment: signature.asc
Description: Digital signature

<Prev in Thread] Current Thread [Next in Thread>