Skip to contentSkip to conversation

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

PATCH Michael Ole Olsen 3 participants 3 messages Jul 21, 2009 – Jul 22, 2009 XFS filesystem

lore
Share & tools
lore
#0 lore raw

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;

fs/xfs/xfs_acl.c +3 -3
Index: 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;
fs/xfs/linux-2.6/xfs_ioctl.c +3 -2
Index: 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;
        }
fs/xfs/linux-2.6/xfs_iops.c +2 -2
Index: 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);
fs/xfs/linux-2.6/xfs_super.c +4 -3
Index: 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,
fs/xfs/linux-2.6/xfs_file.c +2 -2
Index: 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 = {

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#1 lore raw

Hi!

Quoted 2 lines

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.

Thank you for posting this patch. I have a few production boxes too which i needed to downgrade back to 2.6.28 because of the "radix tree oops" problem. Will try if the patch fixes my problems in 2.6.30 too and report back here.

kind regards,
Michael

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#2 lore raw
In reply to Michael Ole Olsen
Quoted 5 lines · Michael Ole Olsen

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).

A little side note here: Just I as an excercise, because I'm a curious person, I performed a similar procedure, taking the xfs sources from 2.6.28.10, put them into a 2.6.30.2 tree, applied the patch and finally booted the resulting kernel:
Don't try this on a machine you don't have console access to ;-)

Cheers,
Martin.

Signature · 7 lines
 Unix _IS_ user friendly - it's just selective about who its friends are !
--------------------------------------------------------------------------

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs