From jblunck at suse.de Mon Nov 2 02:04:41 2009 From: jblunck at suse.de (Jan Blunck) Date: Mon, 2 Nov 2009 11:04:41 +0100 Subject: [Ocfs2-devel] [PATCH 01/27] BKL: Push down BKL from do_new_mount() to the filesystems get_sb/fill_super operation In-Reply-To: <1257156307-24175-1-git-send-email-jblunck@suse.de> References: <1257156307-24175-1-git-send-email-jblunck@suse.de> Message-ID: <1257156307-24175-2-git-send-email-jblunck@suse.de> I've read through all the code formerly covered by the BKL inside do_kern_mount() and have satisfied myself that it doesn't need the BKL any more. do_kern_mount() is already called without the BKL when mounting the rootfs and in nfsctl. do_kern_mount() calls vfs_kern_mount(), which is called from various places without BKL: simple_pin_fs(), nfs_do_clone_mount() through nfs_follow_mountpoint(), afs_mntpt_do_automount() through afs_mntpt_follow_link(). Both later functions are actually the filesystems follow_link inode operation. vfs_kern_mount() is calling the specified get_sb function and lets the filesystem do its job by calling the given fill_super function. Therefore I think it is safe to push down the BKL from the VFS to the low-level filesystems get_sb/fill_super operation. Signed-off-by: Jan Blunck Cc: Matthew Wilcox --- fs/9p/vfs_super.c | 9 ++++++++- fs/adfs/super.c | 8 +++++++- fs/affs/super.c | 9 ++++++++- fs/afs/super.c | 5 +++++ fs/autofs4/inode.c | 4 ++++ fs/befs/linuxvfs.c | 4 ++++ fs/bfs/inode.c | 9 ++++++++- fs/binfmt_misc.c | 6 +++++- fs/btrfs/super.c | 8 +++++++- fs/cifs/cifsfs.c | 12 ++++++++++-- fs/coda/inode.c | 8 +++++++- fs/configfs/mount.c | 5 +++++ fs/cramfs/inode.c | 8 +++++++- fs/devpts/inode.c | 13 +++++++++++-- fs/ecryptfs/main.c | 3 +++ fs/efs/super.c | 10 ++++++++-- fs/exofs/super.c | 7 ++++++- fs/ext2/super.c | 10 ++++++++-- fs/ext3/super.c | 9 ++++++++- fs/ext4/super.c | 9 ++++++--- fs/fat/namei_msdos.c | 6 +++++- fs/fat/namei_vfat.c | 6 +++++- fs/freevxfs/vxfs_super.c | 7 ++++++- fs/fuse/control.c | 9 ++++++++- fs/fuse/inode.c | 5 +++++ fs/gfs2/ops_fstype.c | 9 +++++++++ fs/hfs/super.c | 8 +++++++- fs/hfsplus/super.c | 8 +++++++- fs/hostfs/hostfs_kern.c | 4 ++++ fs/hpfs/super.c | 8 +++++++- fs/hppfs/hppfs.c | 4 ++++ fs/hugetlbfs/inode.c | 12 ++++++++++-- fs/isofs/inode.c | 8 +++++++- fs/jffs2/super.c | 11 +++++++++-- fs/jfs/super.c | 14 ++++++++++++-- fs/libfs.c | 10 +++++++++- fs/minix/inode.c | 8 +++++++- fs/namespace.c | 2 -- fs/ncpfs/inode.c | 8 +++++++- fs/nfs/super.c | 19 +++++++++++++++++++ fs/nfsd/nfsctl.c | 7 ++++++- fs/nilfs2/super.c | 9 ++++++++- fs/ntfs/super.c | 5 +++++ fs/ocfs2/dlm/dlmfs.c | 8 +++++++- fs/ocfs2/super.c | 5 +++++ fs/omfs/inode.c | 7 ++++++- fs/openpromfs/inode.c | 4 ++++ fs/proc/root.c | 9 ++++++++- fs/qnx4/inode.c | 8 +++++++- fs/ramfs/inode.c | 5 +++++ fs/reiserfs/super.c | 4 ++++ fs/romfs/super.c | 9 ++++++++- fs/smbfs/inode.c | 5 +++++ fs/squashfs/super.c | 6 ++++++ fs/sysfs/mount.c | 6 ++++++ fs/sysv/super.c | 24 +++++++++++++++++++----- fs/ubifs/super.c | 5 +++++ fs/udf/super.c | 8 +++++++- fs/ufs/super.c | 5 +++++ fs/xfs/linux-2.6/xfs_super.c | 4 ++++ 60 files changed, 412 insertions(+), 53 deletions(-) diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c index 14a8644..4156a0c 100644 --- a/fs/9p/vfs_super.c +++ b/fs/9p/vfs_super.c @@ -106,11 +106,15 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags, struct p9_fid *fid; int retval = 0; + lock_kernel(); + P9_DPRINTK(P9_DEBUG_VFS, " \n"); v9ses = kzalloc(sizeof(struct v9fs_session_info), GFP_KERNEL); - if (!v9ses) + if (!v9ses) { + unlock_kernel(); return -ENOMEM; + } fid = v9fs_session_init(v9ses, dev_name, data); if (IS_ERR(fid)) { @@ -155,6 +159,7 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags, P9_DPRINTK(P9_DEBUG_VFS, " simple set mount, return 0\n"); simple_set_mnt(mnt, sb); + unlock_kernel(); return 0; free_stat: @@ -167,12 +172,14 @@ clunk_fid: close_session: v9fs_session_close(v9ses); kfree(v9ses); + unlock_kernel(); return retval; release_sb: p9stat_free(st); kfree(st); deactivate_locked_super(sb); + unlock_kernel(); return retval; } diff --git a/fs/adfs/super.c b/fs/adfs/super.c index 6910a98..e94f111 100644 --- a/fs/adfs/super.c +++ b/fs/adfs/super.c @@ -351,11 +351,15 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent) struct adfs_sb_info *asb; struct inode *root; + lock_kernel(); + sb->s_flags |= MS_NODIRATIME; asb = kzalloc(sizeof(*asb), GFP_KERNEL); - if (!asb) + if (!asb) { + unlock_kernel(); return -ENOMEM; + } sb->s_fs_info = asb; /* set default options */ @@ -473,6 +477,7 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent) goto error; } else sb->s_root->d_op = &adfs_dentry_operations; + unlock_kernel(); return 0; error_free_bh: @@ -480,6 +485,7 @@ error_free_bh: error: sb->s_fs_info = NULL; kfree(asb); + unlock_kernel(); return -EINVAL; } diff --git a/fs/affs/super.c b/fs/affs/super.c index 104fdcb..135f0d3 100644 --- a/fs/affs/super.c +++ b/fs/affs/super.c @@ -298,6 +298,8 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent) u8 sig[4]; int ret = -EINVAL; + lock_kernel(); + save_mount_options(sb, data); pr_debug("AFFS: read_super(%s)\n",data ? (const char *)data : "no options"); @@ -307,8 +309,10 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent) sb->s_flags |= MS_NODIRATIME; sbi = kzalloc(sizeof(struct affs_sb_info), GFP_KERNEL); - if (!sbi) + if (!sbi) { + unlock_kernel(); return -ENOMEM; + } sb->s_fs_info = sbi; mutex_init(&sbi->s_bmlock); @@ -316,6 +320,7 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent) &blocksize,&sbi->s_prefix, sbi->s_volume, &mount_flags)) { printk(KERN_ERR "AFFS: Error parsing options\n"); + unlock_kernel(); return -EINVAL; } /* N.B. after this point s_prefix must be released */ @@ -486,6 +491,7 @@ got_root: sb->s_root->d_op = &affs_dentry_operations; pr_debug("AFFS: s_flags=%lX\n",sb->s_flags); + unlock_kernel(); return 0; /* @@ -500,6 +506,7 @@ out_error_noinode: kfree(sbi->s_prefix); kfree(sbi); sb->s_fs_info = NULL; + unlock_kernel(); return ret; } diff --git a/fs/afs/super.c b/fs/afs/super.c index e1ea1c2..108fb3e 100644 --- a/fs/afs/super.c +++ b/fs/afs/super.c @@ -294,12 +294,15 @@ static int afs_fill_super(struct super_block *sb, void *data) struct inode *inode = NULL; int ret; + lock_kernel(); + _enter(""); /* allocate a superblock info record */ as = kzalloc(sizeof(struct afs_super_info), GFP_KERNEL); if (!as) { _leave(" = -ENOMEM"); + unlock_kernel(); return -ENOMEM; } @@ -329,6 +332,7 @@ static int afs_fill_super(struct super_block *sb, void *data) sb->s_root = root; _leave(" = 0"); + unlock_kernel(); return 0; error_inode: @@ -342,6 +346,7 @@ error: sb->s_fs_info = NULL; _leave(" = %d", ret); + unlock_kernel(); return ret; } diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c index 69c8142..3adaba9 100644 --- a/fs/autofs4/inode.c +++ b/fs/autofs4/inode.c @@ -323,6 +323,8 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent) struct autofs_sb_info *sbi; struct autofs_info *ino; + lock_kernel(); + sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); if (!sbi) goto fail_unlock; @@ -418,6 +420,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent) * Success! Install the root dentry now to indicate completion. */ s->s_root = root; + unlock_kernel(); return 0; /* @@ -439,6 +442,7 @@ fail_free: kfree(sbi); s->s_fs_info = NULL; fail_unlock: + unlock_kernel(); return -EINVAL; } diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index 33baf27..f2aa193 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c @@ -759,6 +759,8 @@ befs_fill_super(struct super_block *sb, void *data, int silent) const unsigned long sb_block = 0; const off_t x86_sb_off = 512; + lock_kernel(); + save_mount_options(sb, data); sb->s_fs_info = kmalloc(sizeof (*befs_sb), GFP_KERNEL); @@ -867,6 +869,7 @@ befs_fill_super(struct super_block *sb, void *data, int silent) befs_sb->nls = load_nls_default(); } + unlock_kernel(); return 0; /*****************/ unacquire_bh: @@ -877,6 +880,7 @@ befs_fill_super(struct super_block *sb, void *data, int silent) unacquire_none: sb->s_fs_info = NULL; + unlock_kernel(); return ret; } diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c index 6f60336..4bff506 100644 --- a/fs/bfs/inode.c +++ b/fs/bfs/inode.c @@ -356,9 +356,13 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent) long ret = -EINVAL; unsigned long i_sblock, i_eblock, i_eoff, s_size; + lock_kernel(); + info = kzalloc(sizeof(*info), GFP_KERNEL); - if (!info) + if (!info) { + unlock_kernel(); return -ENOMEM; + } s->s_fs_info = info; sb_set_blocksize(s, BFS_BSIZE); @@ -463,6 +467,7 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent) kfree(info->si_imap); kfree(info); s->s_fs_info = NULL; + unlock_kernel(); return -EIO; } @@ -484,12 +489,14 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent) } dump_imap("read_super", s); mutex_init(&info->bfs_lock); + unlock_kernel(); return 0; out: brelse(bh); kfree(info); s->s_fs_info = NULL; + unlock_kernel(); return ret; } diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c index c4e8353..ca0e22d 100644 --- a/fs/binfmt_misc.c +++ b/fs/binfmt_misc.c @@ -695,9 +695,13 @@ static int bm_fill_super(struct super_block * sb, void * data, int silent) [3] = {"register", &bm_register_operations, S_IWUSR}, /* last one */ {""} }; - int err = simple_fill_super(sb, 0x42494e4d, bm_files); + int err; + + lock_kernel(); + err = simple_fill_super(sb, 0x42494e4d, bm_files); if (!err) sb->s_op = &s_ops; + unlock_kernel(); return err; } diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 752a546..e5cd2cf 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -480,13 +480,17 @@ static int btrfs_get_sb(struct file_system_type *fs_type, int flags, fmode_t mode = FMODE_READ; int error = 0; + lock_kernel(); + if (!(flags & MS_RDONLY)) mode |= FMODE_WRITE; error = btrfs_parse_early_options(data, mode, fs_type, &subvol_name, &fs_devices); - if (error) + if (error) { + unlock_kernel(); return error; + } error = btrfs_scan_one_device(dev_name, mode, fs_type, &fs_devices); if (error) @@ -555,6 +559,7 @@ static int btrfs_get_sb(struct file_system_type *fs_type, int flags, mnt->mnt_root = root; kfree(subvol_name); + unlock_kernel(); return 0; error_s: @@ -563,6 +568,7 @@ error_close_devices: btrfs_close_devices(fs_devices); error_free_subvol_name: kfree(subvol_name); + unlock_kernel(); return error; } diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 9a5e4f5..09ccb9d 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -596,22 +596,30 @@ cifs_get_sb(struct file_system_type *fs_type, int flags, const char *dev_name, void *data, struct vfsmount *mnt) { int rc; - struct super_block *sb = sget(fs_type, NULL, set_anon_super, NULL); + struct super_block *sb; + + lock_kernel(); + + sb = sget(fs_type, NULL, set_anon_super, NULL); cFYI(1, ("Devname: %s flags: %d ", dev_name, flags)); - if (IS_ERR(sb)) + if (IS_ERR(sb)) { + unlock_kernel(); return PTR_ERR(sb); + } sb->s_flags = flags; rc = cifs_read_super(sb, data, dev_name, flags & MS_SILENT ? 1 : 0); if (rc) { deactivate_locked_super(sb); + unlock_kernel(); return rc; } sb->s_flags |= MS_ACTIVE; simple_set_mnt(mnt, sb); + unlock_kernel(); return 0; } diff --git a/fs/coda/inode.c b/fs/coda/inode.c index 830f51a..d081fc5 100644 --- a/fs/coda/inode.c +++ b/fs/coda/inode.c @@ -147,6 +147,8 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent) int error; int idx; + lock_kernel(); + idx = get_device_index((struct coda_mount_data *) data); /* Ignore errors in data, for backward compatibility */ @@ -158,11 +160,13 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent) vc = &coda_comms[idx]; if (!vc->vc_inuse) { printk("coda_read_super: No pseudo device\n"); + unlock_kernel(); return -EINVAL; } if ( vc->vc_sb ) { printk("coda_read_super: Device already mounted\n"); + unlock_kernel(); return -EBUSY; } @@ -196,7 +200,8 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent) sb->s_root = d_alloc_root(root); if (!sb->s_root) goto error; - return 0; + unlock_kernel(); + return 0; error: if (root) @@ -204,6 +209,7 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent) if (vc) vc->vc_sb = NULL; + unlock_kernel(); return -EINVAL; } diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c index 8421cea..5b2e06e 100644 --- a/fs/configfs/mount.c +++ b/fs/configfs/mount.c @@ -71,6 +71,8 @@ static int configfs_fill_super(struct super_block *sb, void *data, int silent) struct inode *inode; struct dentry *root; + lock_kernel(); + sb->s_blocksize = PAGE_CACHE_SIZE; sb->s_blocksize_bits = PAGE_CACHE_SHIFT; sb->s_magic = CONFIGFS_MAGIC; @@ -87,6 +89,7 @@ static int configfs_fill_super(struct super_block *sb, void *data, int silent) inc_nlink(inode); } else { pr_debug("configfs: could not get root inode\n"); + unlock_kernel(); return -ENOMEM; } @@ -94,12 +97,14 @@ static int configfs_fill_super(struct super_block *sb, void *data, int silent) if (!root) { pr_debug("%s: could not get root dentry!\n",__func__); iput(inode); + unlock_kernel(); return -ENOMEM; } config_group_init(&configfs_root_group); configfs_root_group.cg_item.ci_dentry = root; root->d_fsdata = &configfs_root; sb->s_root = root; + unlock_kernel(); return 0; } diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c index dd3634e..13e696a 100644 --- a/fs/cramfs/inode.c +++ b/fs/cramfs/inode.c @@ -227,11 +227,15 @@ static int cramfs_fill_super(struct super_block *sb, void *data, int silent) struct cramfs_sb_info *sbi; struct inode *root; + lock_kernel(); + sb->s_flags |= MS_RDONLY; sbi = kzalloc(sizeof(struct cramfs_sb_info), GFP_KERNEL); - if (!sbi) + if (!sbi) { + unlock_kernel(); return -ENOMEM; + } sb->s_fs_info = sbi; /* Invalidate the read buffers on mount: think disk change.. */ @@ -308,10 +312,12 @@ static int cramfs_fill_super(struct super_block *sb, void *data, int silent) iput(root); goto out; } + unlock_kernel(); return 0; out: kfree(sbi); sb->s_fs_info = NULL; + unlock_kernel(); return -EINVAL; } diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c index d5f8c96..e206eef 100644 --- a/fs/devpts/inode.c +++ b/fs/devpts/inode.c @@ -24,6 +24,7 @@ #include #include #include +#include /* just for lock_kernel() */ #define DEVPTS_DEFAULT_MODE 0600 /* @@ -363,17 +364,23 @@ static int devpts_get_sb(struct file_system_type *fs_type, struct pts_mount_opts opts; struct super_block *s; + lock_kernel(); + error = parse_mount_options(data, PARSE_MOUNT, &opts); - if (error) + if (error) { + unlock_kernel(); return error; + } if (opts.newinstance) s = sget(fs_type, NULL, set_anon_super, NULL); else s = sget(fs_type, compare_init_pts_sb, set_anon_super, NULL); - if (IS_ERR(s)) + if (IS_ERR(s)) { + unlock_kernel(); return PTR_ERR(s); + } if (!s->s_root) { s->s_flags = flags; @@ -391,6 +398,7 @@ static int devpts_get_sb(struct file_system_type *fs_type, if (error) goto out_dput; + unlock_kernel(); return 0; out_dput: @@ -398,6 +406,7 @@ out_dput: out_undo_sget: deactivate_locked_super(s); + unlock_kernel(); return error; } diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c index c6ac85d..fdc7bda 100644 --- a/fs/ecryptfs/main.c +++ b/fs/ecryptfs/main.c @@ -600,6 +600,8 @@ static int ecryptfs_get_sb(struct file_system_type *fs_type, int flags, int rc; struct super_block *sb; + lock_kernel(); + rc = get_sb_nodev(fs_type, flags, raw_data, ecryptfs_fill_super, mnt); if (rc < 0) { printk(KERN_ERR "Getting sb failed; rc = [%d]\n", rc); @@ -621,6 +623,7 @@ out_abort: dput(sb->s_root); /* aka mnt->mnt_root, as set by get_sb_nodev() */ deactivate_locked_super(sb); out: + unlock_kernel(); return rc; } diff --git a/fs/efs/super.c b/fs/efs/super.c index f049428..0981141 100644 --- a/fs/efs/super.c +++ b/fs/efs/super.c @@ -249,9 +249,13 @@ static int efs_fill_super(struct super_block *s, void *d, int silent) struct inode *root; int ret = -EINVAL; - sb = kzalloc(sizeof(struct efs_sb_info), GFP_KERNEL); - if (!sb) + lock_kernel(); + + sb = kzalloc(sizeof(struct efs_sb_info), GFP_KERNEL); + if (!sb) { + unlock_kernel(); return -ENOMEM; + } s->s_fs_info = sb; s->s_magic = EFS_SUPER_MAGIC; @@ -319,12 +323,14 @@ static int efs_fill_super(struct super_block *s, void *d, int silent) goto out_no_fs; } + unlock_kernel(); return 0; out_no_fs_ul: out_no_fs: s->s_fs_info = NULL; kfree(sb); + unlock_kernel(); return ret; } diff --git a/fs/exofs/super.c b/fs/exofs/super.c index 9f500de..ea045b8 100644 --- a/fs/exofs/super.c +++ b/fs/exofs/super.c @@ -297,9 +297,13 @@ static int exofs_fill_super(struct super_block *sb, void *data, int silent) struct osd_obj_id obj; int ret; + lock_kernel(); + sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); - if (!sbi) + if (!sbi) { + unlock_kernel(); return -ENOMEM; + } sb->s_fs_info = sbi; /* use mount options to fill superblock */ @@ -399,6 +403,7 @@ static int exofs_fill_super(struct super_block *sb, void *data, int silent) out: if (or) osd_end_request(or); + unlock_kernel(); return ret; free_sbi: diff --git a/fs/ext2/super.c b/fs/ext2/super.c index 1a9ffee..5af1775 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c @@ -745,15 +745,18 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) __le32 features; int err; + lock_kernel(); + + err = -ENOMEM; sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); if (!sbi) - return -ENOMEM; + goto failed_unlock; sbi->s_blockgroup_lock = kzalloc(sizeof(struct blockgroup_lock), GFP_KERNEL); if (!sbi->s_blockgroup_lock) { kfree(sbi); - return -ENOMEM; + goto failed_unlock; } sb->s_fs_info = sbi; sbi->s_sb_block = sb_block; @@ -1063,6 +1066,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) ext2_warning(sb, __func__, "mounting ext3 filesystem as ext2"); ext2_setup_super (sb, es, sb->s_flags & MS_RDONLY); + unlock_kernel(); return 0; cantfind_ext2: @@ -1086,6 +1090,8 @@ failed_sbi: sb->s_fs_info = NULL; kfree(sbi->s_blockgroup_lock); kfree(sbi); +failed_unlock: + unlock_kernel(); return ret; } diff --git a/fs/ext3/super.c b/fs/ext3/super.c index 7a520a8..38261a5 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c @@ -1568,14 +1568,19 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) __le32 features; int err; + lock_kernel(); + sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); - if (!sbi) + if (!sbi) { + unlock_kernel(); return -ENOMEM; + } sbi->s_blockgroup_lock = kzalloc(sizeof(struct blockgroup_lock), GFP_KERNEL); if (!sbi->s_blockgroup_lock) { kfree(sbi); + unlock_kernel(); return -ENOMEM; } sb->s_fs_info = sbi; @@ -1992,6 +1997,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) "writeback"); lock_kernel(); + unlock_kernel(); return 0; cantfind_ext3: @@ -2022,6 +2028,7 @@ out_fail: kfree(sbi->s_blockgroup_lock); kfree(sbi); lock_kernel(); + unlock_kernel(); return ret; } diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 312211e..9db81d2 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -2328,14 +2328,19 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) int err; unsigned int journal_ioprio = DEFAULT_JOURNAL_IOPRIO; + lock_kernel(); + sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); - if (!sbi) + if (!sbi) { + unlock_kernel(); return -ENOMEM; + } sbi->s_blockgroup_lock = kzalloc(sizeof(struct blockgroup_lock), GFP_KERNEL); if (!sbi->s_blockgroup_lock) { kfree(sbi); + unlock_kernel(); return -ENOMEM; } sb->s_fs_info = sbi; @@ -2913,7 +2918,6 @@ no_journal: ext4_msg(sb, KERN_INFO, "mounted filesystem with%s", descr); - lock_kernel(); return 0; cantfind_ext4: @@ -2959,7 +2963,6 @@ out_fail: sb->s_fs_info = NULL; kfree(sbi->s_blockgroup_lock); kfree(sbi); - lock_kernel(); return ret; } diff --git a/fs/fat/namei_msdos.c b/fs/fat/namei_msdos.c index bbc94ae..31dd072 100644 --- a/fs/fat/namei_msdos.c +++ b/fs/fat/namei_msdos.c @@ -662,12 +662,16 @@ static int msdos_fill_super(struct super_block *sb, void *data, int silent) { int res; + lock_kernel(); res = fat_fill_super(sb, data, silent, &msdos_dir_inode_operations, 0); - if (res) + if (res) { + unlock_kernel(); return res; + } sb->s_flags |= MS_NOATIME; sb->s_root->d_op = &msdos_dentry_operations; + unlock_kernel(); return 0; } diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c index f565f24..12961b8 100644 --- a/fs/fat/namei_vfat.c +++ b/fs/fat/namei_vfat.c @@ -1044,15 +1044,19 @@ static int vfat_fill_super(struct super_block *sb, void *data, int silent) { int res; + lock_kernel(); res = fat_fill_super(sb, data, silent, &vfat_dir_inode_operations, 1); - if (res) + if (res) { + unlock_kernel(); return res; + } if (MSDOS_SB(sb)->options.name_check != 's') sb->s_root->d_op = &vfat_ci_dentry_ops; else sb->s_root->d_op = &vfat_dentry_ops; + unlock_kernel(); return 0; } diff --git a/fs/freevxfs/vxfs_super.c b/fs/freevxfs/vxfs_super.c index 1e8af93..b8b7821 100644 --- a/fs/freevxfs/vxfs_super.c +++ b/fs/freevxfs/vxfs_super.c @@ -148,7 +148,7 @@ static int vxfs_remount(struct super_block *sb, int *flags, char *data) * The superblock on success, else %NULL. * * Locking: - * We are under the bkl and @sbp->s_lock. + * We are under @sbp->s_lock. */ static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent) { @@ -159,11 +159,14 @@ static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent) struct inode *root; int ret = -EINVAL; + lock_kernel(); + sbp->s_flags |= MS_RDONLY; infp = kzalloc(sizeof(*infp), GFP_KERNEL); if (!infp) { printk(KERN_WARNING "vxfs: unable to allocate incore superblock\n"); + unlock_kernel(); return -ENOMEM; } @@ -236,6 +239,7 @@ static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent) goto out_free_ilist; } + unlock_kernel(); return 0; out_free_ilist: @@ -245,6 +249,7 @@ out_free_ilist: out: brelse(bp); kfree(infp); + unlock_kernel(); return ret; } diff --git a/fs/fuse/control.c b/fs/fuse/control.c index 3773fd6..8d769f7 100644 --- a/fs/fuse/control.c +++ b/fs/fuse/control.c @@ -10,6 +10,7 @@ #include #include +#include /* just for lock_kernel() */ #define FUSE_CTL_SUPER_MAGIC 0x65735543 @@ -297,9 +298,13 @@ static int fuse_ctl_fill_super(struct super_block *sb, void *data, int silent) struct fuse_conn *fc; int err; + lock_kernel(); + err = simple_fill_super(sb, FUSE_CTL_SUPER_MAGIC, &empty_descr); - if (err) + if (err) { + unlock_kernel(); return err; + } mutex_lock(&fuse_mutex); BUG_ON(fuse_control_sb); @@ -309,10 +314,12 @@ static int fuse_ctl_fill_super(struct super_block *sb, void *data, int silent) if (err) { fuse_control_sb = NULL; mutex_unlock(&fuse_mutex); + unlock_kernel(); return err; } } mutex_unlock(&fuse_mutex); + unlock_kernel(); return 0; } diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 1a822ce..5690279 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -20,6 +20,7 @@ #include #include #include +#include /* Only for lock_kernel() */ MODULE_AUTHOR("Miklos Szeredi "); MODULE_DESCRIPTION("Filesystem in Userspace"); @@ -919,6 +920,8 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent) int err; int is_bdev = sb->s_bdev != NULL; + lock_kernel(); + err = -EINVAL; if (sb->s_flags & MS_MANDLOCK) goto err; @@ -1022,6 +1025,7 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent) fuse_send_init(fc, init_req); + unlock_kernel(); return 0; err_unlock: @@ -1036,6 +1040,7 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent) err_fput: fput(file); err: + unlock_kernel(); return err; } diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index 52fb6c0..76415fe 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c @@ -1120,9 +1120,12 @@ static int fill_super(struct super_block *sb, void *data, int silent) struct gfs2_holder mount_gh; int error; + lock_kernel(); + sdp = init_sbd(sb); if (!sdp) { printk(KERN_WARNING "GFS2: can't alloc struct gfs2_sbd\n"); + unlock_kernel(); return -ENOMEM; } @@ -1211,6 +1214,7 @@ static int fill_super(struct super_block *sb, void *data, int silent) gfs2_glock_dq_uninit(&mount_gh); gfs2_online_uevent(sdp); + unlock_kernel(); return 0; fail_threads: @@ -1240,6 +1244,7 @@ fail: gfs2_delete_debugfs_file(sdp); kfree(sdp); sb->s_fs_info = NULL; + unlock_kernel(); return error; } @@ -1268,10 +1273,12 @@ static int gfs2_get_sb_meta(struct file_system_type *fs_type, int flags, struct path path; int error; + lock_kernel(); error = kern_path(dev_name, LOOKUP_FOLLOW, &path); if (error) { printk(KERN_WARNING "GFS2: path_lookup on %s returned error %d\n", dev_name, error); + unlock_kernel(); return error; } s = sget(&gfs2_fs_type, test_meta_super, set_meta_super, @@ -1279,11 +1286,13 @@ static int gfs2_get_sb_meta(struct file_system_type *fs_type, int flags, path_put(&path); if (IS_ERR(s)) { printk(KERN_WARNING "GFS2: gfs2 mount does not exist\n"); + unlock_kernel(); return PTR_ERR(s); } sdp = s->s_fs_info; mnt->mnt_sb = s; mnt->mnt_root = dget(sdp->sd_master_dir); + unlock_kernel(); return 0; } diff --git a/fs/hfs/super.c b/fs/hfs/super.c index f7fcbe4..a2e19ff 100644 --- a/fs/hfs/super.c +++ b/fs/hfs/super.c @@ -381,9 +381,13 @@ static int hfs_fill_super(struct super_block *sb, void *data, int silent) struct inode *root_inode; int res; + lock_kernel(); + sbi = kzalloc(sizeof(struct hfs_sb_info), GFP_KERNEL); - if (!sbi) + if (!sbi) { + unlock_kernel(); return -ENOMEM; + } sb->s_fs_info = sbi; INIT_HLIST_HEAD(&sbi->rsrc_inodes); @@ -429,6 +433,7 @@ static int hfs_fill_super(struct super_block *sb, void *data, int silent) sb->s_root->d_op = &hfs_dentry_operations; /* everything's okay */ + unlock_kernel(); return 0; bail_iput: @@ -437,6 +442,7 @@ bail_no_root: printk(KERN_ERR "hfs: get root inode failed.\n"); bail: hfs_mdb_put(sb); + unlock_kernel(); return res; } diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c index 43022f3..824f57a 100644 --- a/fs/hfsplus/super.c +++ b/fs/hfsplus/super.c @@ -312,9 +312,13 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent) struct nls_table *nls = NULL; int err = -EINVAL; + lock_kernel(); + sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); - if (!sbi) + if (!sbi) { + unlock_kernel(); return -ENOMEM; + } sb->s_fs_info = sbi; INIT_HLIST_HEAD(&sbi->rsrc_inodes); @@ -459,11 +463,13 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent) out: unload_nls(sbi->nls); sbi->nls = nls; + unlock_kernel(); return 0; cleanup: hfsplus_put_super(sb); unload_nls(nls); + unlock_kernel(); return err; } diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index 032604e..5eb2c26 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c @@ -968,6 +968,8 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent) char *host_root_path, *req_root = d; int err; + lock_kernel(); + sb->s_blocksize = 1024; sb->s_blocksize_bits = 10; sb->s_magic = HOSTFS_SUPER_MAGIC; @@ -1016,6 +1018,7 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent) goto out; } + unlock_kernel(); return 0; out_put: @@ -1023,6 +1026,7 @@ out_put: out_free: kfree(host_root_path); out: + unlock_kernel(); return err; } diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c index f2feaa0..a7b348a 100644 --- a/fs/hpfs/super.c +++ b/fs/hpfs/super.c @@ -477,11 +477,15 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent) int o; + lock_kernel(); + save_mount_options(s, options); sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); - if (!sbi) + if (!sbi) { + unlock_kernel(); return -ENOMEM; + } s->s_fs_info = sbi; sbi->sb_bmp_dir = NULL; @@ -666,6 +670,7 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent) root->i_blocks = 5; hpfs_brelse4(&qbh); } + unlock_kernel(); return 0; bail4: brelse(bh2); @@ -677,6 +682,7 @@ bail0: kfree(sbi->sb_cp_table); s->s_fs_info = NULL; kfree(sbi); + unlock_kernel(); return -EINVAL; } diff --git a/fs/hppfs/hppfs.c b/fs/hppfs/hppfs.c index a5089a6..6263973 100644 --- a/fs/hppfs/hppfs.c +++ b/fs/hppfs/hppfs.c @@ -712,6 +712,8 @@ static int hppfs_fill_super(struct super_block *sb, void *d, int silent) struct vfsmount *proc_mnt; int err = -ENOENT; + lock_kernel(); + proc_mnt = do_kern_mount("proc", 0, "proc", NULL); if (IS_ERR(proc_mnt)) goto out; @@ -731,6 +733,7 @@ static int hppfs_fill_super(struct super_block *sb, void *d, int silent) if (!sb->s_root) goto out_iput; + unlock_kernel(); return 0; out_iput: @@ -738,6 +741,7 @@ static int hppfs_fill_super(struct super_block *sb, void *d, int silent) out_mntput: mntput(proc_mnt); out: + unlock_kernel(); return(err); } diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 87a1258..53be2b9 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -32,6 +32,7 @@ #include #include #include +#include /* Only for lock_kernel() */ #include @@ -824,6 +825,7 @@ hugetlbfs_fill_super(struct super_block *sb, void *data, int silent) struct hugetlbfs_config config; struct hugetlbfs_sb_info *sbinfo; + lock_kernel(); save_mount_options(sb, data); config.nr_blocks = -1; /* No limit on size by default */ @@ -833,12 +835,16 @@ hugetlbfs_fill_super(struct super_block *sb, void *data, int silent) config.mode = 0755; config.hstate = &default_hstate; ret = hugetlbfs_parse_options(data, &config); - if (ret) + if (ret) { + unlock_kernel(); return ret; + } sbinfo = kmalloc(sizeof(struct hugetlbfs_sb_info), GFP_KERNEL); - if (!sbinfo) + if (!sbinfo) { + unlock_kernel(); return -ENOMEM; + } sb->s_fs_info = sbinfo; sbinfo->hstate = config.hstate; spin_lock_init(&sbinfo->stat_lock); @@ -863,9 +869,11 @@ hugetlbfs_fill_super(struct super_block *sb, void *data, int silent) goto out_free; } sb->s_root = root; + unlock_kernel(); return 0; out_free: kfree(sbinfo); + unlock_kernel(); return -ENOMEM; } diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c index 6b4dcd4..7c501d5 100644 --- a/fs/isofs/inode.c +++ b/fs/isofs/inode.c @@ -571,11 +571,15 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent) int table, error = -EINVAL; unsigned int vol_desc_start; + lock_kernel(); + save_mount_options(s, data); sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); - if (!sbi) + if (!sbi) { + unlock_kernel(); return -ENOMEM; + } s->s_fs_info = sbi; if (!parse_options((char *)data, &opt)) @@ -895,6 +899,7 @@ root_found: kfree(opt.iocharset); + unlock_kernel(); return 0; /* @@ -934,6 +939,7 @@ out_freesbi: kfree(opt.iocharset); kfree(sbi); s->s_fs_info = NULL; + unlock_kernel(); return error; } diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c index 9a80e8e..622bd51 100644 --- a/fs/jffs2/super.c +++ b/fs/jffs2/super.c @@ -148,14 +148,19 @@ static const struct super_operations jffs2_super_operations = static int jffs2_fill_super(struct super_block *sb, void *data, int silent) { struct jffs2_sb_info *c; + int ret; + + lock_kernel(); D1(printk(KERN_DEBUG "jffs2_get_sb_mtd():" " New superblock for device %d (\"%s\")\n", sb->s_mtd->index, sb->s_mtd->name)); c = kzalloc(sizeof(*c), GFP_KERNEL); - if (!c) + if (!c) { + unlock_kernel(); return -ENOMEM; + } c->mtd = sb->s_mtd; c->os_priv = sb; @@ -177,7 +182,9 @@ static int jffs2_fill_super(struct super_block *sb, void *data, int silent) #ifdef CONFIG_JFFS2_FS_POSIX_ACL sb->s_flags |= MS_POSIXACL; #endif - return jffs2_do_fill_super(sb, data, silent); + ret = jffs2_do_fill_super(sb, data, silent); + unlock_kernel(); + return ret; } static int jffs2_get_sb(struct file_system_type *fs_type, diff --git a/fs/jfs/super.c b/fs/jfs/super.c index 2234c73..329d7b6 100644 --- a/fs/jfs/super.c +++ b/fs/jfs/super.c @@ -425,14 +425,20 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent) s64 newLVSize = 0; int flag, ret = -EINVAL; + lock_kernel(); + jfs_info("In jfs_read_super: s_flags=0x%lx", sb->s_flags); - if (!new_valid_dev(sb->s_bdev->bd_dev)) + if (!new_valid_dev(sb->s_bdev->bd_dev)) { + unlock_kernel(); return -EOVERFLOW; + } sbi = kzalloc(sizeof (struct jfs_sb_info), GFP_KERNEL); - if (!sbi) + if (!sbi) { + unlock_kernel(); return -ENOMEM; + } sb->s_fs_info = sbi; sbi->sb = sb; sbi->uid = sbi->gid = sbi->umask = -1; @@ -442,6 +448,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent) if (!parse_options((char *) data, sb, &newLVSize, &flag)) { kfree(sbi); + unlock_kernel(); return -EINVAL; } sbi->flag = flag; @@ -452,6 +459,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent) if (newLVSize) { printk(KERN_ERR "resize option for remount only\n"); + unlock_kernel(); return -EINVAL; } @@ -527,6 +535,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent) sb->s_maxbytes = min(((u64) PAGE_CACHE_SIZE << 32) - 1, sb->s_maxbytes); #endif sb->s_time_gran = 1; + unlock_kernel(); return 0; out_no_root: @@ -548,6 +557,7 @@ out_kfree: if (sbi->nls_tab) unload_nls(sbi->nls_tab); kfree(sbi); + unlock_kernel(); return ret; } diff --git a/fs/libfs.c b/fs/libfs.c index 219576c..3484040 100644 --- a/fs/libfs.c +++ b/fs/libfs.c @@ -11,6 +11,7 @@ #include #include #include +#include /* Only for lock_kernel() */ #include @@ -422,6 +423,8 @@ int simple_fill_super(struct super_block *s, int magic, struct tree_descr *files struct dentry *dentry; int i; + lock_kernel(); + s->s_blocksize = PAGE_CACHE_SIZE; s->s_blocksize_bits = PAGE_CACHE_SHIFT; s->s_magic = magic; @@ -429,8 +432,10 @@ int simple_fill_super(struct super_block *s, int magic, struct tree_descr *files s->s_time_gran = 1; inode = new_inode(s); - if (!inode) + if (!inode) { + unlock_kernel(); return -ENOMEM; + } /* * because the root inode is 1, the files array must not contain an * entry at index 1 @@ -444,6 +449,7 @@ int simple_fill_super(struct super_block *s, int magic, struct tree_descr *files root = d_alloc_root(inode); if (!root) { iput(inode); + unlock_kernel(); return -ENOMEM; } for (i = 0; !files->name || files->name[0]; i++, files++) { @@ -469,10 +475,12 @@ int simple_fill_super(struct super_block *s, int magic, struct tree_descr *files d_add(dentry, inode); } s->s_root = root; + unlock_kernel(); return 0; out: d_genocide(root); dput(root); + unlock_kernel(); return -ENOMEM; } diff --git a/fs/minix/inode.c b/fs/minix/inode.c index 74ea82d..b8aa0a6 100644 --- a/fs/minix/inode.c +++ b/fs/minix/inode.c @@ -147,9 +147,13 @@ static int minix_fill_super(struct super_block *s, void *data, int silent) struct minix_sb_info *sbi; int ret = -EINVAL; + lock_kernel(); + sbi = kzalloc(sizeof(struct minix_sb_info), GFP_KERNEL); - if (!sbi) + if (!sbi) { + unlock_kernel(); return -ENOMEM; + } s->s_fs_info = sbi; BUILD_BUG_ON(32 != sizeof (struct minix_inode)); @@ -265,6 +269,7 @@ static int minix_fill_super(struct super_block *s, void *data, int silent) else if (sbi->s_mount_state & MINIX_ERROR_FS) printk("MINIX-fs: mounting file system with errors, " "running fsck is recommended\n"); + unlock_kernel(); return 0; out_iput: @@ -314,6 +319,7 @@ out_bad_sb: out: s->s_fs_info = NULL; kfree(sbi); + unlock_kernel(); return ret; } diff --git a/fs/namespace.c b/fs/namespace.c index bdc3cb4..3f95497 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -1647,9 +1647,7 @@ static int do_new_mount(struct path *path, char *type, int flags, if (!capable(CAP_SYS_ADMIN)) return -EPERM; - lock_kernel(); mnt = do_kern_mount(type, flags, name, data); - unlock_kernel(); if (IS_ERR(mnt)) return PTR_ERR(mnt); diff --git a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c index cf98da1..a020d86 100644 --- a/fs/ncpfs/inode.c +++ b/fs/ncpfs/inode.c @@ -445,10 +445,14 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent) #endif struct ncp_entry_info finfo; + lock_kernel(); + data.wdog_pid = NULL; server = kzalloc(sizeof(struct ncp_server), GFP_KERNEL); - if (!server) + if (!server) { + unlock_kernel(); return -ENOMEM; + } sb->s_fs_info = server; error = -EFAULT; @@ -695,6 +699,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent) if (!sb->s_root) goto out_no_root; sb->s_root->d_op = &ncp_root_dentry_operations; + unlock_kernel(); return 0; out_no_root: @@ -729,6 +734,7 @@ out: put_pid(data.wdog_pid); sb->s_fs_info = NULL; kfree(server); + unlock_kernel(); return error; } diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 90be551..1f97aad 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c @@ -1877,6 +1877,8 @@ nfs_remount(struct super_block *sb, int *flags, char *raw_data) options->version <= 6)))) return 0; + lock_kernel(); + data = kzalloc(sizeof(*data), GFP_KERNEL); if (data == NULL) return -ENOMEM; @@ -2184,6 +2186,7 @@ out: out_free_fh: kfree(mntfh); kfree(data); + unlock_kernel(); return error; out_err_nosb: @@ -2227,6 +2230,8 @@ static int nfs_xdev_get_sb(struct file_system_type *fs_type, int flags, }; int error; + lock_kernel(); + dprintk("--> nfs_xdev_get_sb()\n"); /* create a new volume representation */ @@ -2281,17 +2286,20 @@ static int nfs_xdev_get_sb(struct file_system_type *fs_type, int flags, security_sb_clone_mnt_opts(data->sb, s); dprintk("<-- nfs_xdev_get_sb() = 0\n"); + unlock_kernel(); return 0; out_err_nosb: nfs_free_server(server); out_err_noserver: dprintk("<-- nfs_xdev_get_sb() = %d [error]\n", error); + unlock_kernel(); return error; error_splat_super: deactivate_locked_super(s); dprintk("<-- nfs_xdev_get_sb() = %d [splat]\n", error); + unlock_kernel(); return error; } @@ -2475,6 +2483,8 @@ static int nfs4_remote_get_sb(struct file_system_type *fs_type, }; int error = -ENOMEM; + lock_kernel(); + mntfh = kzalloc(sizeof(*mntfh), GFP_KERNEL); if (data == NULL || mntfh == NULL) goto out_free_fh; @@ -2534,6 +2544,7 @@ out: security_free_mnt_opts(&data->lsm_opts); out_free_fh: kfree(mntfh); + unlock_kernel(); return error; out_free: @@ -2794,6 +2805,8 @@ static int nfs4_remote_referral_get_sb(struct file_system_type *fs_type, }; int error; + lock_kernel(); + dprintk("--> nfs4_referral_get_sb()\n"); /* create a new volume representation */ @@ -2847,17 +2860,20 @@ static int nfs4_remote_referral_get_sb(struct file_system_type *fs_type, security_sb_clone_mnt_opts(data->sb, s); dprintk("<-- nfs4_referral_get_sb() = 0\n"); + unlock_kernel(); return 0; out_err_nosb: nfs_free_server(server); out_err_noserver: dprintk("<-- nfs4_referral_get_sb() = %d [error]\n", error); + unlock_kernel(); return error; error_splat_super: deactivate_locked_super(s); dprintk("<-- nfs4_referral_get_sb() = %d [splat]\n", error); + unlock_kernel(); return error; } @@ -2873,6 +2889,8 @@ static int nfs4_referral_get_sb(struct file_system_type *fs_type, struct vfsmount *root_mnt; int error; + lock_kernel(); + dprintk("--> nfs4_referral_get_sb()\n"); export_path = data->mnt_path; @@ -2890,6 +2908,7 @@ static int nfs4_referral_get_sb(struct file_system_type *fs_type, out: dprintk("<-- nfs4_referral_get_sb() = %d%s\n", error, error != 0 ? " [error]" : ""); + unlock_kernel(); return error; } diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index 5c01fc1..dcaef52 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c @@ -1347,7 +1347,12 @@ static int nfsd_fill_super(struct super_block * sb, void * data, int silent) #endif /* last one */ {""} }; - return simple_fill_super(sb, 0x6e667364, nfsd_files); + int ret; + + lock_kernel(); + ret = simple_fill_super(sb, 0x6e667364, nfsd_files); + unlock_kernel(); + return ret; } static int nfsd_get_sb(struct file_system_type *fs_type, diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c index 644e667..3448ec3 100644 --- a/fs/nilfs2/super.c +++ b/fs/nilfs2/super.c @@ -1059,9 +1059,13 @@ nilfs_get_sb(struct file_system_type *fs_type, int flags, struct the_nilfs *nilfs; int err, need_to_close = 1; + lock_kernel(); + sd.bdev = open_bdev_exclusive(dev_name, flags, fs_type); - if (IS_ERR(sd.bdev)) + if (IS_ERR(sd.bdev)) { + unlock_kernel(); return PTR_ERR(sd.bdev); + } /* * To get mount instance using sget() vfs-routine, NILFS needs @@ -1142,6 +1146,7 @@ nilfs_get_sb(struct file_system_type *fs_type, int flags, if (need_to_close) close_bdev_exclusive(sd.bdev, flags); simple_set_mnt(mnt, s); + unlock_kernel(); return 0; failed_unlock: @@ -1150,6 +1155,7 @@ nilfs_get_sb(struct file_system_type *fs_type, int flags, failed: close_bdev_exclusive(sd.bdev, flags); + unlock_kernel(); return err; cancel_new: @@ -1163,6 +1169,7 @@ nilfs_get_sb(struct file_system_type *fs_type, int flags, * We must finish all post-cleaning before this call; * put_nilfs() needs the block device. */ + unlock_kernel(); return err; } diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c index 80b0477..ab09c02 100644 --- a/fs/ntfs/super.c +++ b/fs/ntfs/super.c @@ -2723,6 +2723,8 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent) struct inode *tmp_ino; int blocksize, result; + lock_kernel(); + /* * We do a pretty difficult piece of bootstrap by reading the * MFT (and other metadata) from disk into memory. We'll only @@ -2746,6 +2748,7 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent) ntfs_error(sb, "Allocation of NTFS volume structure " "failed. Aborting mount..."); lockdep_on(); + unlock_kernel(); return -ENOMEM; } /* Initialize ntfs_volume structure. */ @@ -2933,6 +2936,7 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent) sb->s_export_op = &ntfs_export_ops; lock_kernel(); lockdep_on(); + unlock_kernel(); return 0; } ntfs_error(sb, "Failed to allocate root directory."); @@ -3053,6 +3057,7 @@ err_out_now: kfree(vol); ntfs_debug("Failed, returning -EINVAL."); lockdep_on(); + unlock_kernel(); return -EINVAL; } diff --git a/fs/ocfs2/dlm/dlmfs.c b/fs/ocfs2/dlm/dlmfs.c index 02bf178..58ce813 100644 --- a/fs/ocfs2/dlm/dlmfs.c +++ b/fs/ocfs2/dlm/dlmfs.c @@ -528,21 +528,27 @@ static int dlmfs_fill_super(struct super_block * sb, struct inode * inode; struct dentry * root; + lock_kernel(); + sb->s_maxbytes = MAX_LFS_FILESIZE; sb->s_blocksize = PAGE_CACHE_SIZE; sb->s_blocksize_bits = PAGE_CACHE_SHIFT; sb->s_magic = DLMFS_MAGIC; sb->s_op = &dlmfs_ops; inode = dlmfs_get_root_inode(sb); - if (!inode) + if (!inode) { + unlock_kernel(); return -ENOMEM; + } root = d_alloc_root(inode); if (!root) { iput(inode); + unlock_kernel(); return -ENOMEM; } sb->s_root = root; + unlock_kernel(); return 0; } diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index c0e48ae..fab815f 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c @@ -986,6 +986,8 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) char nodestr[8]; struct ocfs2_blockcheck_stats stats; + lock_kernel(); + mlog_entry("%p, %p, %i", sb, data, silent); if (!ocfs2_parse_options(sb, data, &parsed_options, 0)) { @@ -1172,6 +1174,7 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) atomic_set(&osb->vol_state, VOLUME_DISABLED); wake_up(&osb->osb_mount_event); mlog_exit(status); + unlock_kernel(); return status; } } @@ -1186,6 +1189,7 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) ocfs2_orphan_scan_start(osb); mlog_exit(status); + unlock_kernel(); return status; read_super_error: @@ -1201,6 +1205,7 @@ read_super_error: } mlog_exit(status); + unlock_kernel(); return status; } diff --git a/fs/omfs/inode.c b/fs/omfs/inode.c index f3b7c15..ddfbb22 100644 --- a/fs/omfs/inode.c +++ b/fs/omfs/inode.c @@ -416,11 +416,15 @@ static int omfs_fill_super(struct super_block *sb, void *data, int silent) sector_t start; int ret = -EINVAL; + lock_kernel(); + save_mount_options(sb, (char *) data); sbi = kzalloc(sizeof(struct omfs_sb_info), GFP_KERNEL); - if (!sbi) + if (!sbi) { + unlock_kernel(); return -ENOMEM; + } sb->s_fs_info = sbi; @@ -525,6 +529,7 @@ out_brelse_bh2: out_brelse_bh: brelse(bh); end: + unlock_kernel(); return ret; } diff --git a/fs/openpromfs/inode.c b/fs/openpromfs/inode.c index ffcd04f..50dc4be 100644 --- a/fs/openpromfs/inode.c +++ b/fs/openpromfs/inode.c @@ -386,6 +386,8 @@ static int openprom_fill_super(struct super_block *s, void *data, int silent) struct op_inode_info *oi; int ret; + lock_kernel(); + s->s_flags |= MS_NOATIME; s->s_blocksize = 1024; s->s_blocksize_bits = 10; @@ -405,6 +407,7 @@ static int openprom_fill_super(struct super_block *s, void *data, int silent) s->s_root = d_alloc_root(root_inode); if (!s->s_root) goto out_no_root_dentry; + unlock_kernel(); return 0; out_no_root_dentry: @@ -412,6 +415,7 @@ out_no_root_dentry: ret = -ENOMEM; out_no_root: printk("openprom_fill_super: get root inode failed\n"); + unlock_kernel(); return ret; } diff --git a/fs/proc/root.c b/fs/proc/root.c index b080b79..6384680 100644 --- a/fs/proc/root.c +++ b/fs/proc/root.c @@ -18,6 +18,7 @@ #include #include #include +#include /* For lock_kernel() only */ #include "internal.h" @@ -43,6 +44,8 @@ static int proc_get_sb(struct file_system_type *fs_type, struct pid_namespace *ns; struct proc_inode *ei; + lock_kernel(); + if (proc_mnt) { /* Seed the root directory with a pid so it doesn't need * to be special in base.c. I would do this earlier but @@ -60,14 +63,17 @@ static int proc_get_sb(struct file_system_type *fs_type, ns = current->nsproxy->pid_ns; sb = sget(fs_type, proc_test_super, proc_set_super, ns); - if (IS_ERR(sb)) + if (IS_ERR(sb)) { + unlock_kernel(); return PTR_ERR(sb); + } if (!sb->s_root) { sb->s_flags = flags; err = proc_fill_super(sb); if (err) { deactivate_locked_super(sb); + unlock_kernel(); return err; } @@ -83,6 +89,7 @@ static int proc_get_sb(struct file_system_type *fs_type, } simple_set_mnt(mnt, sb); + unlock_kernel(); return 0; } diff --git a/fs/qnx4/inode.c b/fs/qnx4/inode.c index d2cd179..18640ce 100644 --- a/fs/qnx4/inode.c +++ b/fs/qnx4/inode.c @@ -253,9 +253,13 @@ static int qnx4_fill_super(struct super_block *s, void *data, int silent) struct qnx4_sb_info *qs; int ret = -EINVAL; + lock_kernel(); + qs = kzalloc(sizeof(struct qnx4_sb_info), GFP_KERNEL); - if (!qs) + if (!qs) { + unlock_kernel(); return -ENOMEM; + } s->s_fs_info = qs; sb_set_blocksize(s, QNX4_BLOCK_SIZE); @@ -303,6 +307,7 @@ static int qnx4_fill_super(struct super_block *s, void *data, int silent) brelse(bh); + unlock_kernel(); return 0; outi: @@ -312,6 +317,7 @@ static int qnx4_fill_super(struct super_block *s, void *data, int silent) outnobh: kfree(qs); s->s_fs_info = NULL; + unlock_kernel(); return ret; } diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c index a6090aa..9b3983f 100644 --- a/fs/ramfs/inode.c +++ b/fs/ramfs/inode.c @@ -35,6 +35,7 @@ #include #include #include +#include /* Only for lock_kernel() */ #include #include "internal.h" @@ -220,6 +221,8 @@ static int ramfs_fill_super(struct super_block * sb, void * data, int silent) struct dentry *root; int err; + lock_kernel(); + save_mount_options(sb, data); fsi = kzalloc(sizeof(struct ramfs_fs_info), GFP_KERNEL); @@ -253,11 +256,13 @@ static int ramfs_fill_super(struct super_block * sb, void * data, int silent) goto fail; } + unlock_kernel(); return 0; fail: kfree(fsi); sb->s_fs_info = NULL; iput(inode); + unlock_kernel(); return err; } diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index f0ad05f..f32bf62 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c @@ -1608,6 +1608,8 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent) char *qf_names[MAXQUOTAS] = {}; unsigned int qfmt = 0; + lock_kernel(); + save_mount_options(s, data); sbi = kzalloc(sizeof(struct reiserfs_sb_info), GFP_KERNEL); @@ -1852,6 +1854,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent) init_waitqueue_head(&(sbi->s_wait)); spin_lock_init(&sbi->bitmap_lock); + unlock_kernel(); return (0); error: @@ -1872,6 +1875,7 @@ error: kfree(sbi); s->s_fs_info = NULL; + unlock_kernel(); return errval; } diff --git a/fs/romfs/super.c b/fs/romfs/super.c index c117fa8..7342617 100644 --- a/fs/romfs/super.c +++ b/fs/romfs/super.c @@ -468,6 +468,8 @@ static int romfs_fill_super(struct super_block *sb, void *data, int silent) size_t len; int ret; + lock_kernel(); + #ifdef CONFIG_BLOCK if (!sb->s_mtd) { sb_set_blocksize(sb, ROMBSIZE); @@ -484,8 +486,10 @@ static int romfs_fill_super(struct super_block *sb, void *data, int silent) /* read the image superblock and check it */ rsb = kmalloc(512, GFP_KERNEL); - if (!rsb) + if (!rsb) { + unlock_kernel(); return -ENOMEM; + } sb->s_fs_info = (void *) 512; ret = romfs_dev_read(sb, 0, rsb, 512); @@ -535,15 +539,18 @@ static int romfs_fill_super(struct super_block *sb, void *data, int silent) if (!sb->s_root) goto error_i; + unlock_kernel(); return 0; error_i: iput(root); error: + unlock_kernel(); return -EINVAL; error_rsb_inval: ret = -EINVAL; error_rsb: + unlock_kernel(); return ret; } diff --git a/fs/smbfs/inode.c b/fs/smbfs/inode.c index 1c4c8f0..c3c9044 100644 --- a/fs/smbfs/inode.c +++ b/fs/smbfs/inode.c @@ -500,6 +500,8 @@ static int smb_fill_super(struct super_block *sb, void *raw_data, int silent) void *mem; static int warn_count; + lock_kernel(); + if (warn_count < 5) { warn_count++; printk(KERN_EMERG "smbfs is deprecated and will be removed" @@ -615,6 +617,7 @@ static int smb_fill_super(struct super_block *sb, void *raw_data, int silent) smb_new_dentry(sb->s_root); + unlock_kernel(); return 0; out_no_root: @@ -635,9 +638,11 @@ out_wrong_data: out_no_data: printk(KERN_ERR "smb_fill_super: missing data argument\n"); out_fail: + unlock_kernel(); return -EINVAL; out_no_server: printk(KERN_ERR "smb_fill_super: cannot allocate struct smb_sb_info\n"); + unlock_kernel(); return -ENOMEM; } diff --git a/fs/squashfs/super.c b/fs/squashfs/super.c index 6c197ef..23cea83 100644 --- a/fs/squashfs/super.c +++ b/fs/squashfs/super.c @@ -78,11 +78,14 @@ static int squashfs_fill_super(struct super_block *sb, void *data, int silent) u64 lookup_table_start; int err; + lock_kernel(); + TRACE("Entered squashfs_fill_superblock\n"); sb->s_fs_info = kzalloc(sizeof(*msblk), GFP_KERNEL); if (sb->s_fs_info == NULL) { ERROR("Failed to allocate squashfs_sb_info\n"); + unlock_kernel(); return -ENOMEM; } msblk = sb->s_fs_info; @@ -286,6 +289,7 @@ allocate_root: TRACE("Leaving squashfs_fill_super\n"); kfree(sblk); + unlock_kernel(); return 0; failed_mount: @@ -299,12 +303,14 @@ failed_mount: kfree(sb->s_fs_info); sb->s_fs_info = NULL; kfree(sblk); + unlock_kernel(); return err; failure: kfree(msblk->stream.workspace); kfree(sb->s_fs_info); sb->s_fs_info = NULL; + unlock_kernel(); return -ENOMEM; } diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c index 4974995..2e5a870 100644 --- a/fs/sysfs/mount.c +++ b/fs/sysfs/mount.c @@ -18,6 +18,7 @@ #include #include #include +#include /* Only for lock_kernel() */ #include "sysfs.h" @@ -45,6 +46,8 @@ static int sysfs_fill_super(struct super_block *sb, void *data, int silent) struct inode *inode; struct dentry *root; + lock_kernel(); + sb->s_blocksize = PAGE_CACHE_SIZE; sb->s_blocksize_bits = PAGE_CACHE_SHIFT; sb->s_magic = SYSFS_MAGIC; @@ -58,6 +61,7 @@ static int sysfs_fill_super(struct super_block *sb, void *data, int silent) mutex_unlock(&sysfs_mutex); if (!inode) { pr_debug("sysfs: could not get root inode\n"); + unlock_kernel(); return -ENOMEM; } @@ -66,10 +70,12 @@ static int sysfs_fill_super(struct super_block *sb, void *data, int silent) if (!root) { pr_debug("%s: could not get root dentry!\n",__func__); iput(inode); + unlock_kernel(); return -ENOMEM; } root->d_fsdata = &sysfs_root; sb->s_root = root; + unlock_kernel(); return 0; } diff --git a/fs/sysv/super.c b/fs/sysv/super.c index 5a903da..145d949 100644 --- a/fs/sysv/super.c +++ b/fs/sysv/super.c @@ -357,7 +357,9 @@ static int sysv_fill_super(struct super_block *sb, void *data, int silent) struct sysv_sb_info *sbi; unsigned long blocknr; int size = 0, i; - + + lock_kernel(); + BUILD_BUG_ON(1024 != sizeof (struct xenix_super_block)); BUILD_BUG_ON(512 != sizeof (struct sysv4_super_block)); BUILD_BUG_ON(512 != sizeof (struct sysv2_super_block)); @@ -365,8 +367,10 @@ static int sysv_fill_super(struct super_block *sb, void *data, int silent) BUILD_BUG_ON(64 != sizeof (struct sysv_inode)); sbi = kzalloc(sizeof(struct sysv_sb_info), GFP_KERNEL); - if (!sbi) + if (!sbi) { + unlock_kernel(); return -ENOMEM; + } sbi->s_sb = sb; sbi->s_block_base = 0; @@ -409,8 +413,10 @@ static int sysv_fill_super(struct super_block *sb, void *data, int silent) if (bh && bh1) { sbi->s_bh1 = bh1; sbi->s_bh2 = bh; - if (complete_read_super(sb, silent, size)) + if (complete_read_super(sb, silent, size)) { + unlock_kernel(); return 0; + } } brelse(bh1); @@ -419,6 +425,7 @@ static int sysv_fill_super(struct super_block *sb, void *data, int silent) printk("oldfs: cannot read superblock\n"); failed: kfree(sbi); + unlock_kernel(); return -EINVAL; Eunknown: @@ -442,14 +449,18 @@ static int v7_fill_super(struct super_block *sb, void *data, int silent) struct v7_super_block *v7sb; struct sysv_inode *v7i; + lock_kernel(); + if (440 != sizeof (struct v7_super_block)) panic("V7 FS: bad super-block size"); if (64 != sizeof (struct sysv_inode)) panic("sysv fs: bad i-node size"); sbi = kzalloc(sizeof(struct sysv_sb_info), GFP_KERNEL); - if (!sbi) + if (!sbi) { + unlock_kernel(); return -ENOMEM; + } sbi->s_sb = sb; sbi->s_block_base = 0; @@ -487,13 +498,16 @@ static int v7_fill_super(struct super_block *sb, void *data, int silent) sbi->s_bh1 = bh; sbi->s_bh2 = bh; - if (complete_read_super(sb, silent, 1)) + if (complete_read_super(sb, silent, 1)) { + unlock_kernel(); return 0; + } failed: brelse(bh2); brelse(bh); kfree(sbi); + unlock_kernel(); return -EINVAL; } diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 333e181..04a0fc9 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c @@ -2029,6 +2029,8 @@ static int ubifs_get_sb(struct file_system_type *fs_type, int flags, struct super_block *sb; int err; + lock_kernel(); + dbg_gen("name %s, flags %#x", name, flags); /* @@ -2040,6 +2042,7 @@ static int ubifs_get_sb(struct file_system_type *fs_type, int flags, if (IS_ERR(ubi)) { ubifs_err("cannot open \"%s\", error %d", name, (int)PTR_ERR(ubi)); + unlock_kernel(); return PTR_ERR(ubi); } ubi_get_volume_info(ubi, &vi); @@ -2077,12 +2080,14 @@ static int ubifs_get_sb(struct file_system_type *fs_type, int flags, ubi_close_volume(ubi); simple_set_mnt(mnt, sb); + unlock_kernel(); return 0; out_deact: deactivate_locked_super(sb); out_close: ubi_close_volume(ubi); + unlock_kernel(); return err; } diff --git a/fs/udf/super.c b/fs/udf/super.c index 9d1b8c2..fa6f8db 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c @@ -1866,6 +1866,8 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) struct kernel_lb_addr rootdir, fileset; struct udf_sb_info *sbi; + lock_kernel(); + uopt.flags = (1 << UDF_FLAG_USE_AD_IN_ICB) | (1 << UDF_FLAG_STRICT); uopt.uid = -1; uopt.gid = -1; @@ -1874,8 +1876,10 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) uopt.dmode = UDF_INVALID_MODE; sbi = kzalloc(sizeof(struct udf_sb_info), GFP_KERNEL); - if (!sbi) + if (!sbi) { + unlock_kernel(); return -ENOMEM; + } sb->s_fs_info = sbi; @@ -2021,6 +2025,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) goto error_out; } sb->s_maxbytes = MAX_LFS_FILESIZE; + unlock_kernel(); return 0; error_out: @@ -2041,6 +2046,7 @@ error_out: kfree(sbi); sb->s_fs_info = NULL; + unlock_kernel(); return -EINVAL; } diff --git a/fs/ufs/super.c b/fs/ufs/super.c index 5faed79..31ad198 100644 --- a/fs/ufs/super.c +++ b/fs/ufs/super.c @@ -646,6 +646,8 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent) unsigned maxsymlen; int ret = -EINVAL; + lock_kernel(); + uspi = NULL; ubh = NULL; flags = 0; @@ -1107,6 +1109,7 @@ magic_found: goto failed; UFSD("EXIT\n"); + unlock_kernel(); return 0; dalloc_failed: @@ -1118,10 +1121,12 @@ failed: kfree(sbi); sb->s_fs_info = NULL; UFSD("EXIT (FAILED)\n"); + unlock_kernel(); return ret; failed_nomem: UFSD("EXIT (NOMEM)\n"); + unlock_kernel(); return -ENOMEM; } diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c index 18a4b8e..7426166 100644 --- a/fs/xfs/linux-2.6/xfs_super.c +++ b/fs/xfs/linux-2.6/xfs_super.c @@ -1412,6 +1412,8 @@ xfs_fs_fill_super( int flags = 0, error = ENOMEM; char *mtpt = NULL; + lock_kernel(); + mp = kzalloc(sizeof(struct xfs_mount), GFP_KERNEL); if (!mp) goto out; @@ -1506,6 +1508,7 @@ xfs_fs_fill_super( kfree(mtpt); xfs_itrace_exit(XFS_I(sb->s_root->d_inode)); + unlock_kernel(); return 0; out_filestream_unmount: @@ -1522,6 +1525,7 @@ xfs_fs_fill_super( kfree(mtpt); kfree(mp); out: + unlock_kernel(); return -error; fail_vnrele: -- 1.6.4.2 From sunil.mushran at oracle.com Mon Nov 2 13:38:10 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Mon, 2 Nov 2009 13:38:10 -0800 Subject: [Ocfs2-devel] [PATCH 1/1] ocfs2: Refresh documentation Message-ID: <1257197890-16493-1-git-send-email-sunil.mushran@oracle.com> Signed-off-by: Sunil Mushran --- Documentation/filesystems/ocfs2.txt | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Documentation/filesystems/ocfs2.txt b/Documentation/filesystems/ocfs2.txt index c2a0871..c58b9f5 100644 --- a/Documentation/filesystems/ocfs2.txt +++ b/Documentation/filesystems/ocfs2.txt @@ -20,15 +20,16 @@ Lots of code taken from ext3 and other projects. Authors in alphabetical order: Joel Becker Zach Brown -Mark Fasheh +Mark Fasheh Kurt Hackel +Tao Ma Sunil Mushran Manish Singh +Tiger Yang Caveats ======= Features which OCFS2 does not support yet: - - quotas - Directory change notification (F_NOTIFY) - Distributed Caching (F_SETLEASE/F_GETLEASE/break_lease) @@ -70,7 +71,6 @@ commit=nrsec (*) Ocfs2 can be told to sync all its data and metadata performance. localalloc=8(*) Allows custom localalloc size in MB. If the value is too large, the fs will silently revert it to the default. - Localalloc is not enabled for local mounts. localflocks This disables cluster aware flock. inode64 Indicates that Ocfs2 is allowed to create inodes at any location in the filesystem, including those which -- 1.5.6.5 From sunil.mushran at oracle.com Fri Nov 6 14:50:22 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Fri, 6 Nov 2009 14:50:22 -0800 Subject: [Ocfs2-devel] [PATCH 1/1] ocfs2: Trivial cleanup of jbd compatibility layer removal Message-ID: <1257547822-4246-1-git-send-email-sunil.mushran@oracle.com> Mainline commit 53ef99cad9878f02f27bb30bc304fc42af8bdd6e removed the JBD compatibility layer from OCFS2. This patch removes the last remaining remnants of that. Signed-off-by: Sunil Mushran --- fs/ocfs2/ocfs2.h | 7 +------ fs/ocfs2/uptodate.c | 5 ----- 2 files changed, 1 insertions(+), 11 deletions(-) diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h index eae4046..d963d86 100644 --- a/fs/ocfs2/ocfs2.h +++ b/fs/ocfs2/ocfs2.h @@ -35,12 +35,7 @@ #include #include #include -#ifndef CONFIG_OCFS2_COMPAT_JBD -# include -#else -# include -# include "ocfs2_jbd_compat.h" -#endif +#include /* For union ocfs2_dlm_lksb */ #include "stackglue.h" diff --git a/fs/ocfs2/uptodate.c b/fs/ocfs2/uptodate.c index b6284f2..c613693 100644 --- a/fs/ocfs2/uptodate.c +++ b/fs/ocfs2/uptodate.c @@ -53,11 +53,6 @@ #include #include #include -#ifndef CONFIG_OCFS2_COMPAT_JBD -# include -#else -# include -#endif #define MLOG_MASK_PREFIX ML_UPTODATE -- 1.6.3.3 From sunil.mushran at oracle.com Fri Nov 6 15:24:22 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Fri, 6 Nov 2009 15:24:22 -0800 Subject: [Ocfs2-devel] Extend FIEMAP to indicate shared extents Message-ID: <1257549864-18901-1-git-send-email-sunil.mushran@oracle.com> Please could I get your ACK for these patches. This adds a FIEMAP extent flag, FIEMAP_EXTENT_SHARED, to indicate extents that are shared by multiple files. The second patch makes use of the same in the OCFS2 file system to show such extents in the reflinked files. Thanks Sunil From sunil.mushran at oracle.com Fri Nov 6 15:24:23 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Fri, 6 Nov 2009 15:24:23 -0800 Subject: [Ocfs2-devel] [PATCH 1/2] fiemap: Add new extent flag FIEMAP_EXTENT_SHARED In-Reply-To: <1257549864-18901-1-git-send-email-sunil.mushran@oracle.com> References: <1257549864-18901-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1257549864-18901-2-git-send-email-sunil.mushran@oracle.com> Patch adds flag FIEMAP_EXTENT_SHARED to denote extents that are shared with other inodes. Signed-off-by: Sunil Mushran Acked-by: Mark Fasheh --- include/linux/fiemap.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/include/linux/fiemap.h b/include/linux/fiemap.h index 934e22d..d830747 100644 --- a/include/linux/fiemap.h +++ b/include/linux/fiemap.h @@ -62,5 +62,7 @@ struct fiemap { #define FIEMAP_EXTENT_MERGED 0x00001000 /* File does not natively * support extents. Result * merged for efficiency. */ +#define FIEMAP_EXTENT_SHARED 0x00002000 /* Space shared with other + * files. */ #endif /* _LINUX_FIEMAP_H */ -- 1.5.6.5 From sunil.mushran at oracle.com Fri Nov 6 15:24:24 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Fri, 6 Nov 2009 15:24:24 -0800 Subject: [Ocfs2-devel] [PATCH 2/2] ocfs2: Use FIEMAP_EXTENT_SHARED In-Reply-To: <1257549864-18901-1-git-send-email-sunil.mushran@oracle.com> References: <1257549864-18901-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1257549864-18901-3-git-send-email-sunil.mushran@oracle.com> Adds FIEMAP_EXTENT_SHARED flag to refcounted extents. Signed-off-by: Sunil Mushran Acked-by: Mark Fasheh --- fs/ocfs2/extent_map.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/fs/ocfs2/extent_map.c b/fs/ocfs2/extent_map.c index 843db64..cdce5f8 100644 --- a/fs/ocfs2/extent_map.c +++ b/fs/ocfs2/extent_map.c @@ -786,6 +786,8 @@ int ocfs2_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, fe_flags = 0; if (rec.e_flags & OCFS2_EXT_UNWRITTEN) fe_flags |= FIEMAP_EXTENT_UNWRITTEN; + if (rec.e_flags & OCFS2_EXT_REFCOUNTED) + fe_flags |= FIEMAP_EXTENT_SHARED; if (is_last) fe_flags |= FIEMAP_EXTENT_LAST; len_bytes = (u64)le16_to_cpu(rec.e_leaf_clusters) << osb->s_clustersize_bits; -- 1.5.6.5 From sunil.mushran at oracle.com Mon Nov 9 16:08:53 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Mon, 9 Nov 2009 16:08:53 -0800 Subject: [Ocfs2-devel] Initial patches for ocfs2 1.6 Message-ID: <1257811737-10835-1-git-send-email-sunil.mushran@oracle.com> So the ocfs2 1.6 repository is up. It is a copy of the fs in the mainline. I have some 70-80 patches that will make it run atop el5 u4. The patches will be posted in smaller batches so as to make it easier to review. The first set handles the makefiles, etc. Sunil From sunil.mushran at oracle.com Mon Nov 9 16:08:57 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Mon, 9 Nov 2009 16:08:57 -0800 Subject: [Ocfs2-devel] [PATCH 4/4] ocfs2: Fix version files In-Reply-To: <1257811737-10835-1-git-send-email-sunil.mushran@oracle.com> References: <1257811737-10835-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1257811737-10835-5-git-send-email-sunil.mushran@oracle.com> Signed-off-by: Sunil Mushran --- fs/ocfs2/cluster/ver.c | 8 +++++--- fs/ocfs2/dlm/dlmfsver.c | 7 ++++--- fs/ocfs2/dlm/dlmver.c | 7 ++++--- fs/ocfs2/ver.c | 12 +++++++++--- 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/fs/ocfs2/cluster/ver.c b/fs/ocfs2/cluster/ver.c index a56eee6..6ab31de 100644 --- a/fs/ocfs2/cluster/ver.c +++ b/fs/ocfs2/cluster/ver.c @@ -28,9 +28,9 @@ #include "ver.h" -#define CLUSTER_BUILD_VERSION "1.5.0" - -#define VERSION_STR "OCFS2 Node Manager " CLUSTER_BUILD_VERSION +#define VERSION_STR "OCFS2 Node Manager " \ + CLUSTER_BUILD_VERSION " " CLUSTER_BUILD_DATE \ + " (build " CLUSTER_BUILD_MD5 ")" void cluster_print_version(void) { @@ -39,4 +39,6 @@ void cluster_print_version(void) MODULE_DESCRIPTION(VERSION_STR); +#ifdef MODULE_VERSION MODULE_VERSION(CLUSTER_BUILD_VERSION); +#endif diff --git a/fs/ocfs2/dlm/dlmfsver.c b/fs/ocfs2/dlm/dlmfsver.c index a733b33..38872d0 100644 --- a/fs/ocfs2/dlm/dlmfsver.c +++ b/fs/ocfs2/dlm/dlmfsver.c @@ -28,9 +28,8 @@ #include "dlmfsver.h" -#define DLM_BUILD_VERSION "1.5.0" - -#define VERSION_STR "OCFS2 DLMFS " DLM_BUILD_VERSION +#define VERSION_STR "OCFS2 DLMFS " \ + DLM_BUILD_VERSION " " DLM_BUILD_DATE " (build " DLM_BUILD_MD5 ")" void dlmfs_print_version(void) { @@ -39,4 +38,6 @@ void dlmfs_print_version(void) MODULE_DESCRIPTION(VERSION_STR); +#ifdef MODULE_VERSION MODULE_VERSION(DLM_BUILD_VERSION); +#endif diff --git a/fs/ocfs2/dlm/dlmver.c b/fs/ocfs2/dlm/dlmver.c index dfc0da4..71061b9 100644 --- a/fs/ocfs2/dlm/dlmver.c +++ b/fs/ocfs2/dlm/dlmver.c @@ -28,9 +28,8 @@ #include "dlmver.h" -#define DLM_BUILD_VERSION "1.5.0" - -#define VERSION_STR "OCFS2 DLM " DLM_BUILD_VERSION +#define VERSION_STR "OCFS2 DLM " \ + DLM_BUILD_VERSION " " DLM_BUILD_DATE " (build " DLM_BUILD_MD5 ")" void dlm_print_version(void) { @@ -39,4 +38,6 @@ void dlm_print_version(void) MODULE_DESCRIPTION(VERSION_STR); +#ifdef MODULE_VERSION MODULE_VERSION(DLM_BUILD_VERSION); +#endif diff --git a/fs/ocfs2/ver.c b/fs/ocfs2/ver.c index e2488f4..f715770 100644 --- a/fs/ocfs2/ver.c +++ b/fs/ocfs2/ver.c @@ -29,15 +29,21 @@ #include "ver.h" -#define OCFS2_BUILD_VERSION "1.5.0" - -#define VERSION_STR "OCFS2 " OCFS2_BUILD_VERSION +#define VERSION_STR "OCFS2 " \ + OCFS2_BUILD_VERSION " " OCFS2_BUILD_DATE " (build " OCFS2_BUILD_MD5 ")" void ocfs2_print_version(void) { printk(KERN_INFO "%s\n", VERSION_STR); } +int ocfs2_str_version(char *buf) +{ + return sprintf(buf, "%s\n", VERSION_STR); +} + MODULE_DESCRIPTION(VERSION_STR); +#ifdef MODULE_VERSION MODULE_VERSION(OCFS2_BUILD_VERSION); +#endif -- 1.5.6.5 From sunil.mushran at oracle.com Mon Nov 9 16:08:55 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Mon, 9 Nov 2009 16:08:55 -0800 Subject: [Ocfs2-devel] [PATCH 2/4] ocfs2: Copy Makefiles from ocfs2-1.4 In-Reply-To: <1257811737-10835-1-git-send-email-sunil.mushran@oracle.com> References: <1257811737-10835-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1257811737-10835-3-git-send-email-sunil.mushran@oracle.com> Signed-off-by: Sunil Mushran --- fs/ocfs2/Makefile | 212 ++++++++++++++++++++++++++++++++++----------- fs/ocfs2/cluster/Makefile | 89 ++++++++++++++++++- fs/ocfs2/dlm/Makefile | 105 +++++++++++++++++++++- 3 files changed, 347 insertions(+), 59 deletions(-) diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile index 31f25ce..7438431 100644 --- a/fs/ocfs2/Makefile +++ b/fs/ocfs2/Makefile @@ -1,54 +1,164 @@ -EXTRA_CFLAGS += -Ifs/ocfs2 - -EXTRA_CFLAGS += -DCATCH_BH_JBD_RACES - -obj-$(CONFIG_OCFS2_FS) += \ - ocfs2.o \ - ocfs2_stackglue.o - -obj-$(CONFIG_OCFS2_FS_O2CB) += ocfs2_stack_o2cb.o -obj-$(CONFIG_OCFS2_FS_USERSPACE_CLUSTER) += ocfs2_stack_user.o - -ocfs2-objs := \ - alloc.o \ - aops.o \ - blockcheck.o \ - buffer_head_io.o \ - dcache.o \ - dir.o \ - dlmglue.o \ - export.o \ - extent_map.o \ - file.o \ - heartbeat.o \ - inode.o \ - ioctl.o \ - journal.o \ - localalloc.o \ - locks.o \ - mmap.o \ - namei.o \ - refcounttree.o \ - resize.o \ - slot_map.o \ - suballoc.o \ - super.o \ - symlink.o \ - sysfile.o \ - uptodate.o \ - ver.o \ - quota_local.o \ - quota_global.o \ - xattr.o - -ifeq ($(CONFIG_OCFS2_FS_POSIX_ACL),y) -ocfs2-objs += acl.o + +ifeq ($(KERNELRELEASE),) +TOPDIR = ../.. + +include $(TOPDIR)/Preamble.make +else +# We are included by kbuild. + +OUR_TOPDIR := $(M)/.. + +include $(OUR_TOPDIR)/Config.make + +endif + +COMPAT_SOURCES = +COMPAT_HEADERS = +SOURCES = +HEADERS = + +EXTRA_CFLAGS += -I$(OUR_TOPDIR)/fs/ocfs2 + +ifdef OCFS_DEBUG +EXTRA_CFLAGS += -g +EXTRA_CFLAGS += -DDEBUG +endif + +EXTRA_CFLAGS += -DCATCH_BH_JBD_RACES -DOCFS2_ORACORE_WORKAROUNDS + +EXTRA_CFLAGS += -DOCFS2_CDSL + +EXTRA_CFLAGS += -DCONFIG_OCFS2_DEBUG_MASKLOG + +EXTRA_CFLAGS += -DCONFIG_OCFS2_FS_STATS + +# +# Since SUBDIRS means something to kbuild, define them safely. Do not +# include trailing slashes. +# +SAFE_SUBDIRS = cluster dlm + +SOURCES += \ + acl.c \ + alloc.c \ + aops.c \ + blockcheck.c \ + buffer_head_io.c \ + dcache.c \ + dir.c \ + dlmglue.c \ + export.c \ + extent_map.c \ + file.c \ + heartbeat.c \ + inode.c \ + ioctl.c \ + journal.c \ + localalloc.c \ + locks.c \ + mmap.c \ + namei.c \ + quota_global.c \ + quota_local.c \ + resize.c \ + slot_map.c \ + stackglue.c \ + stack_o2cb.c \ + stack_user.c \ + suballoc.c \ + super.c \ + symlink.c \ + sysfile.c \ + uptodate.c \ + ver.c \ + xattr.c + +HEADERS += \ + acl.h \ + alloc.h \ + aops.h \ + blockcheck.h \ + buffer_head_io.h \ + dcache.h \ + dir.h \ + dlmglue.h \ + export.h \ + extent_map.h \ + file.h \ + heartbeat.h \ + inode.h \ + ioctl.h \ + journal.h \ + localalloc.h \ + locks.h \ + mmap.h \ + namei.h \ + ocfs1_fs_compat.h \ + ocfs2_fs.h \ + ocfs2.h \ + ocfs2_lockid.h \ + ocfs2_lockingver.h \ + quota.h \ + resize.h \ + slot_map.h \ + stackglue.h \ + suballoc.h \ + super.h \ + symlink.h \ + sysfile.h \ + uptodate.h \ + ver.h \ + xattr.h + +OBJECTS = $(subst .c,.o,$(SOURCES)) +VERSION_FILES = $(SOURCES) $(HEADERS) $(COMPAT_SOURCES) $(COMPAT_HEADERS) +VERSION_SRC = ver.c +VERSION_PREFIX = OCFS2 + +INSTALL_MOD_DIR := fs/ocfs2 + +obj-m := ocfs2.o + +ocfs2-objs := $(OBJECTS) + +ifneq ($(KERNELRELEASE),) +# +# Argh, Versioning.make has ordering requirements, so we put this here +# +STAMP_DIR := $(OUR_TOPDIR)/fs/ocfs2 +include $(OUR_TOPDIR)/Versioning.make +CFLAGS_$(VERSION_OBJ) += $(VERDEFS) + +obj-m += $(addsuffix /,$(SAFE_SUBDIRS)) endif -ocfs2_stackglue-objs := stackglue.o -ocfs2_stack_o2cb-objs := stack_o2cb.o -ocfs2_stack_user-objs := stack_user.o +ifeq ($(KERNELRELEASE),) +# +# Called from a regular "make". Just forward to kbuild. +# + +DIST_FILES = $(SOURCES) $(HEADERS) $(COMPAT_SOURCES) $(COMPAT_HEADERS) + +ALL_RULES = stamp-md5 build-modules + +CLEAN_RULES = clean-modules -# cluster/ is always needed when OCFS2_FS for masklog support -obj-$(CONFIG_OCFS2_FS) += cluster/ -obj-$(CONFIG_OCFS2_FS_O2CB) += dlm/ +INSTALL_RULES = install-modules + +# Traverse subdirs via Makebo for "make dist" +ifeq ($(MAKECMDGOALS),dist-all) +SUBDIRS = $(SAFE_SUBDIRS) +endif + +build-modules: + $(MAKE) -C $(TOPDIR)/fs build-modules + +install-modules: + $(MAKE) -C $(TOPDIR)/fs install-modules + +clean-modules: + $(MAKE) -C $(TOPDIR)/fs clean-modules + +include $(TOPDIR)/Postamble.make + +endif diff --git a/fs/ocfs2/cluster/Makefile b/fs/ocfs2/cluster/Makefile index bc8c5e7..fc5d3a0 100644 --- a/fs/ocfs2/cluster/Makefile +++ b/fs/ocfs2/cluster/Makefile @@ -1,4 +1,87 @@ -obj-$(CONFIG_OCFS2_FS) += ocfs2_nodemanager.o -ocfs2_nodemanager-objs := heartbeat.o masklog.o sys.o nodemanager.o \ - quorum.o tcp.o netdebug.o ver.o +ifeq ($(KERNELRELEASE),) +TOPDIR = ../../.. + +include $(TOPDIR)/Preamble.make +else +# We are included by kbuild. + +OUR_TOPDIR := $(M)/.. + +include $(OUR_TOPDIR)/Config.make +endif + +COMPAT_SOURCES = +COMPAT_HEADERS = +SOURCES = +HEADERS = + +EXTRA_CFLAGS += -DCONFIG_OCFS2_DEBUG_MASKLOG + +SOURCES += \ + heartbeat.c \ + masklog.c \ + netdebug.c \ + nodemanager.c \ + quorum.c \ + sys.c \ + tcp.c \ + ver.c + +HEADERS += \ + heartbeat.h \ + masklog.h \ + nodemanager.h \ + ocfs2_heartbeat.h \ + ocfs2_nodemanager.h \ + quorum.h \ + sys.h \ + tcp.h \ + tcp_internal.h \ + ver.h + +OBJECTS = $(subst .c,.o,$(SOURCES)) +VERSION_FILES = $(SOURCES) $(HEADERS) $(COMPAT_SOURCES) $(COMPAT_HEADERS) +VERSION_SRC = ver.c +VERSION_PREFIX = CLUSTER + +INSTALL_MOD_DIR := fs/ocfs2 + +obj-m := ocfs2_nodemanager.o + +ocfs2_nodemanager-objs := $(OBJECTS) + +ifneq ($(KERNELRELEASE),) +# +# Argh, Versioning.make has ordering requirements, so we put this here +# +STAMP_DIR := $(OUR_TOPDIR)/fs/ocfs2/cluster +include $(OUR_TOPDIR)/Versioning.make +CFLAGS_$(VERSION_OBJ) += $(VERDEFS) +endif + +ifeq ($(KERNELRELEASE),) +# +# Called from a regular "make". Just forward to kbuild. +# + +DIST_FILES = $(SOURCES) $(HEADERS) $(COMPAT_SOURCES) $(COMPAT_HEADERS) + +ALL_RULES = stamp-md5 build-modules + +CLEAN_RULES = clean-modules + +INSTALL_RULES = install-modules + +build-modules: + $(MAKE) -C $(TOPDIR)/fs build-modules + +install-modules: + $(MAKE) -C $(TOPDIR)/fs install-modules + +clean-modules: + $(MAKE) -C $(TOPDIR)/fs clean-modules + +include $(TOPDIR)/Postamble.make + +endif diff --git a/fs/ocfs2/dlm/Makefile b/fs/ocfs2/dlm/Makefile index 1903613..26cbf6c 100644 --- a/fs/ocfs2/dlm/Makefile +++ b/fs/ocfs2/dlm/Makefile @@ -1,8 +1,103 @@ -EXTRA_CFLAGS += -Ifs/ocfs2 -obj-$(CONFIG_OCFS2_FS_O2CB) += ocfs2_dlm.o ocfs2_dlmfs.o +ifeq ($(KERNELRELEASE),) +TOPDIR = ../../.. -ocfs2_dlm-objs := dlmdomain.o dlmdebug.o dlmthread.o dlmrecovery.o \ - dlmmaster.o dlmast.o dlmconvert.o dlmlock.o dlmunlock.o dlmver.o +include $(TOPDIR)/Preamble.make -ocfs2_dlmfs-objs := userdlm.o dlmfs.o dlmfsver.o +else +# We are included by kbuild. + +OUR_TOPDIR := $(M)/.. + +include $(OUR_TOPDIR)/Config.make +endif + +COMPAT_SOURCES = +COMPAT_HEADERS = +DLM_SOURCES = +DLMFS_SOURCES = +HEADERS = + +EXTRA_CFLAGS += -I$(OUR_TOPDIR)/fs/ocfs2 + +EXTRA_CFLAGS += -DCONFIG_OCFS2_DEBUG_MASKLOG + +DLM_SOURCES += \ + dlmast.c \ + dlmconvert.c \ + dlmdebug.c \ + dlmdomain.c \ + dlmlock.c \ + dlmmaster.c \ + dlmrecovery.c \ + dlmthread.c \ + dlmunlock.c \ + dlmver.c + +DLMFS_SOURCES += \ + userdlm.c \ + dlmfs.c \ + dlmfsver.c + +HEADERS += \ + dlmapi.h \ + dlmcommon.h \ + dlmconvert.h \ + dlmdebug.h \ + dlmdomain.h \ + dlmfsver.h \ + dlmver.h \ + userdlm.h + +DLM_OBJECTS = $(subst .c,.o,$(DLM_SOURCES)) +DLMFS_OBJECTS = $(subst .c,.o,$(DLMFS_SOURCES)) + +VERSION_FILES = $(DLM_SOURCES) $(DLMFS_SOURCES) $(HEADERS) $(COMPAT_SOURCES) $(COMPAT_HEADERS) +VERSION_SRC = dlmver.c dlmfsver.c +VERSION_PREFIX = DLM + +INSTALL_MOD_DIR := fs/ocfs2 + +obj-m := ocfs2_dlm.o ocfs2_dlmfs.o + +ocfs2_dlm-objs := $(DLM_OBJECTS) + +ocfs2_dlmfs-objs := $(DLMFS_OBJECTS) + +ifneq ($(KERNELRELEASE),) +# +# Argh, Versioning.make has ordering requirements, so we put this here +# +STAMP_DIR := $(OUR_TOPDIR)/fs/ocfs2/dlm +include $(OUR_TOPDIR)/Versioning.make +endif + +# This has to be outside a conditional, because of a bug in make +# It's harmless in the regular make case, as VERSION_OBJ will be empty +$(foreach objfile,$(VERSION_OBJ),$(eval CFLAGS_$(objfile) += $(VERDEFS))) + +ifeq ($(KERNELRELEASE),) +# +# Called from a regular "make". Just forward to kbuild. +# + +DIST_FILES = $(DLM_SOURCES) $(DLMFS_SOURCES) $(HEADERS) $(COMPAT_SOURCES) $(COMPAT_HEADERS) + +ALL_RULES = stamp-md5 build-modules + +CLEAN_RULES = clean-modules + +INSTALL_RULES = install-modules + +build-modules: + $(MAKE) -C $(TOPDIR)/fs build-modules + +install-modules: + $(MAKE) -C $(TOPDIR)/fs install-modules + +clean-modules: + $(MAKE) -C $(TOPDIR)/fs clean-modules + +include $(TOPDIR)/Postamble.make + +endif -- 1.5.6.5 From sunil.mushran at oracle.com Mon Nov 9 16:08:56 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Mon, 9 Nov 2009 16:08:56 -0800 Subject: [Ocfs2-devel] [PATCH 3/4] ocfs2: Fix ocfs2 makefile In-Reply-To: <1257811737-10835-1-git-send-email-sunil.mushran@oracle.com> References: <1257811737-10835-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1257811737-10835-4-git-send-email-sunil.mushran@oracle.com> Teach the makefile to handle stackglue and friends. Signed-off-by: Sunil Mushran --- fs/ocfs2/Makefile | 115 ++++++++++++++++------------------------------------- 1 files changed, 34 insertions(+), 81 deletions(-) diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile index 7438431..8222d03 100644 --- a/fs/ocfs2/Makefile +++ b/fs/ocfs2/Makefile @@ -14,8 +14,12 @@ endif COMPAT_SOURCES = COMPAT_HEADERS = -SOURCES = -HEADERS = +FS_SOURCES = +FS_HEADERS = +GLUE_SOURCES = +GLUE_HEADERS = +O2CB_SOURCES = +USER_SOURCES = EXTRA_CFLAGS += -I$(OUR_TOPDIR)/fs/ocfs2 @@ -26,8 +30,6 @@ endif EXTRA_CFLAGS += -DCATCH_BH_JBD_RACES -DOCFS2_ORACORE_WORKAROUNDS -EXTRA_CFLAGS += -DOCFS2_CDSL - EXTRA_CFLAGS += -DCONFIG_OCFS2_DEBUG_MASKLOG EXTRA_CFLAGS += -DCONFIG_OCFS2_FS_STATS @@ -38,88 +40,37 @@ EXTRA_CFLAGS += -DCONFIG_OCFS2_FS_STATS # SAFE_SUBDIRS = cluster dlm -SOURCES += \ - acl.c \ - alloc.c \ - aops.c \ - blockcheck.c \ - buffer_head_io.c \ - dcache.c \ - dir.c \ - dlmglue.c \ - export.c \ - extent_map.c \ - file.c \ - heartbeat.c \ - inode.c \ - ioctl.c \ - journal.c \ - localalloc.c \ - locks.c \ - mmap.c \ - namei.c \ - quota_global.c \ - quota_local.c \ - resize.c \ - slot_map.c \ - stackglue.c \ - stack_o2cb.c \ - stack_user.c \ - suballoc.c \ - super.c \ - symlink.c \ - sysfile.c \ - uptodate.c \ - ver.c \ - xattr.c - -HEADERS += \ - acl.h \ - alloc.h \ - aops.h \ - blockcheck.h \ - buffer_head_io.h \ - dcache.h \ - dir.h \ - dlmglue.h \ - export.h \ - extent_map.h \ - file.h \ - heartbeat.h \ - inode.h \ - ioctl.h \ - journal.h \ - localalloc.h \ - locks.h \ - mmap.h \ - namei.h \ - ocfs1_fs_compat.h \ - ocfs2_fs.h \ - ocfs2.h \ - ocfs2_lockid.h \ - ocfs2_lockingver.h \ - quota.h \ - resize.h \ - slot_map.h \ - stackglue.h \ - suballoc.h \ - super.h \ - symlink.h \ - sysfile.h \ - uptodate.h \ - ver.h \ - xattr.h - -OBJECTS = $(subst .c,.o,$(SOURCES)) -VERSION_FILES = $(SOURCES) $(HEADERS) $(COMPAT_SOURCES) $(COMPAT_HEADERS) +GLUE_SOURCES = stackglue.c +GLUE_HEADERS = stackglue.h +O2CB_SOURCES = stack_o2cb.c +USER_SOURCES = stack_user.c + +FS_SOURCES += acl.c alloc.c aops.c blockcheck.c buffer_head_io.c dcache.c \ + dir.c dlmglue.c export.c extent_map.c file.c heartbeat.c inode.c \ + ioctl.c journal.c localalloc.c locks.c mmap.c namei.c quota_global.c \ + quota_local.c refcounttree.c resize.c slot_map.c suballoc.c super.c \ + symlink.c sysfile.c uptodate.c ver.c xattr.c + +FS_HEADERS += acl.h alloc.h aops.h blockcheck.h buffer_head_io.h dcache.h \ + dir.h dlmglue.h export.h extent_map.h file.h heartbeat.h inode.h \ + ioctl.h journal.h localalloc.h locks.h mmap.h namei.h ocfs1_fs_compat.h \ + ocfs2_fs.h ocfs2.h ocfs2_lockid.h ocfs2_lockingver.h quota.h \ + refcounttree.h resize.h slot_map.h suballoc.h super.h symlink.h \ + sysfile.h uptodate.h ver.h xattr.h + +FS_OBJECTS = $(subst .c,.o,$(FS_SOURCES)) +VERSION_FILES = $(FS_SOURCES) $(FS_HEADERS) $(COMPAT_SOURCES) $(COMPAT_HEADERS) VERSION_SRC = ver.c VERSION_PREFIX = OCFS2 INSTALL_MOD_DIR := fs/ocfs2 -obj-m := ocfs2.o +obj-m := ocfs2.o ocfs2_stackglue.o ocfs2_stack_o2cb.o ocfs2_stack_user.o -ocfs2-objs := $(OBJECTS) +ocfs2-objs := $(FS_OBJECTS) +ocfs2_stackglue-objs := stackglue.o +ocfs2_stack_o2cb-objs := stack_o2cb.o +ocfs2_stack_user-objs := stack_user.o ifneq ($(KERNELRELEASE),) # @@ -137,7 +88,9 @@ ifeq ($(KERNELRELEASE),) # Called from a regular "make". Just forward to kbuild. # -DIST_FILES = $(SOURCES) $(HEADERS) $(COMPAT_SOURCES) $(COMPAT_HEADERS) +DIST_FILES = $(FS_SOURCES) $(FS_HEADERS) $(COMPAT_SOURCES) $(COMPAT_HEADERS) \ + $(GLUE_SOURCES) $(GLUE_HEADERS) $(O2CB_SOURCES) $(O2CB_HEADERS) \ + $(USER_SOURCES) $(USER_HEADERS) ALL_RULES = stamp-md5 build-modules -- 1.5.6.5 From sunil.mushran at oracle.com Mon Nov 9 16:08:54 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Mon, 9 Nov 2009 16:08:54 -0800 Subject: [Ocfs2-devel] [PATCH 1/4] ocfs2: Add .gitignore In-Reply-To: <1257811737-10835-1-git-send-email-sunil.mushran@oracle.com> References: <1257811737-10835-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1257811737-10835-2-git-send-email-sunil.mushran@oracle.com> Signed-off-by: Sunil Mushran --- .gitignore | 43 +++++++++++++++++++++++++++++++++++++++++++ fs/ocfs2/.gitignore | 35 +++++++++++++++++++++++++++++++++++ fs/ocfs2/cluster/.gitignore | 35 +++++++++++++++++++++++++++++++++++ fs/ocfs2/dlm/.gitignore | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 148 insertions(+), 0 deletions(-) create mode 100644 .gitignore create mode 100644 fs/ocfs2/.gitignore create mode 100644 fs/ocfs2/cluster/.gitignore create mode 100644 fs/ocfs2/dlm/.gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9346a6d --- /dev/null +++ b/.gitignore @@ -0,0 +1,43 @@ +# +# Normal rules +# +# +.* +*.o +*.o.* +*.a +*.s +*.ko +*.mod.c +*.i +.*.sw? +*.pc + +# +# Top-level generic files +# +!.gitignore +!.mailmap + +# cscope files +cscope.* +ncscope.* + +# autoconf files +Config.make +autom4te.cache +config.log +config.status +configure + +# misc +stamp-md5 +*.orig +*~ +\#*# + +Module.markers +Module.symvers + +ocfs2-*.src.rpm +ocfs2-*.tar.gz diff --git a/fs/ocfs2/.gitignore b/fs/ocfs2/.gitignore new file mode 100644 index 0000000..eca2a17 --- /dev/null +++ b/fs/ocfs2/.gitignore @@ -0,0 +1,35 @@ +# +# Normal rules +# +# +.* +*.o +*.o.* +*.a +*.s +*.ko +*.mod.c +*.i + +# +# Top-level generic files +# +!.gitignore +!.mailmap + +# cscope files +cscope.* +ncscope.* + +# autoconf files +Config.make +autom4te.cache +config.log +config.status +configure + +# misc +stamp-md5 +*.orig +*~ +\#*# diff --git a/fs/ocfs2/cluster/.gitignore b/fs/ocfs2/cluster/.gitignore new file mode 100644 index 0000000..eca2a17 --- /dev/null +++ b/fs/ocfs2/cluster/.gitignore @@ -0,0 +1,35 @@ +# +# Normal rules +# +# +.* +*.o +*.o.* +*.a +*.s +*.ko +*.mod.c +*.i + +# +# Top-level generic files +# +!.gitignore +!.mailmap + +# cscope files +cscope.* +ncscope.* + +# autoconf files +Config.make +autom4te.cache +config.log +config.status +configure + +# misc +stamp-md5 +*.orig +*~ +\#*# diff --git a/fs/ocfs2/dlm/.gitignore b/fs/ocfs2/dlm/.gitignore new file mode 100644 index 0000000..eca2a17 --- /dev/null +++ b/fs/ocfs2/dlm/.gitignore @@ -0,0 +1,35 @@ +# +# Normal rules +# +# +.* +*.o +*.o.* +*.a +*.s +*.ko +*.mod.c +*.i + +# +# Top-level generic files +# +!.gitignore +!.mailmap + +# cscope files +cscope.* +ncscope.* + +# autoconf files +Config.make +autom4te.cache +config.log +config.status +configure + +# misc +stamp-md5 +*.orig +*~ +\#*# -- 1.5.6.5 From sunil.mushran at oracle.com Mon Nov 9 18:00:11 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Mon, 9 Nov 2009 18:00:11 -0800 Subject: [Ocfs2-devel] [PATCH 08/10] ocfs2: Handle struct address_space_operations_ext In-Reply-To: <1257818413-32014-1-git-send-email-sunil.mushran@oracle.com> References: <1257818413-32014-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1257818413-32014-9-git-send-email-sunil.mushran@oracle.com> Around in 2.6.24 or so, two new aops, write_begin() and write_end(), were added. In that release, OCFS2 was updated to make use of these aops instead of the older prepare_write() and commit_write(). EL5 U4 backports the new aops in a new struct address_space_operations_ext. This patch looks for the new struct failing which looks for the new aops in the older struct. If both lookups fail, the build errors out. Signed-off-by: Sunil Mushran --- Config.make.in | 1 + configure.in | 13 +++++++++++++ fs/ocfs2/Makefile | 4 ++++ fs/ocfs2/aops.c | 16 ++++++++++++++++ fs/ocfs2/inode.c | 5 +++++ fs/ocfs2/inode.h | 4 ++++ fs/ocfs2/super.c | 4 ++++ 7 files changed, 47 insertions(+), 0 deletions(-) diff --git a/Config.make.in b/Config.make.in index eb8e2a9..aead755 100644 --- a/Config.make.in +++ b/Config.make.in @@ -60,6 +60,7 @@ EXTRA_CFLAGS += @KAPI_COMPAT_CFLAGS@ NO_DELAYED_WORK_STRUCT = @NO_DELAYED_WORK_STRUCT@ NO_DLMCONSTANTS_HEADER = @NO_DLMCONSTANTS_HEADER@ NO_F_PATH_IN_STRUCT_FILE = @NO_F_PATH_IN_STRUCT_FILE@ +ADDRESS_SPACE_OPS_EXT = @ADDRESS_SPACE_OPS_EXT@ OCFS_DEBUG = @OCFS_DEBUG@ diff --git a/configure.in b/configure.in index e29e6df..8179f59 100644 --- a/configure.in +++ b/configure.in @@ -199,6 +199,19 @@ OCFS2_CHECK_KERNEL([f_path in fs.h], fs.h, AC_SUBST(NO_F_PATH_IN_STRUCT_FILE) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS fpath.h" +ADDRESS_SPACE_OPS_EXT= +OCFS2_CHECK_KERNEL([ struct address_space_operations_ext in fs.h], fs.h, + ADDRESS_SPACE_OPS_EXT=yes, , [^struct address_space_operations_ext {]) +AC_SUBST(ADDRESS_SPACE_OPS_EXT) +if test "x$ADDRESS_SPACE_OPS_EXT" = "x" ; then + has_write_begin= + OCFS2_CHECK_KERNEL([ write_begin() in fs.h], fs.h, + has_write_begin=yes, , [int (\*write_begin)(struct file \*]) + if test "x$has_write_begin" = "x" ; then + AC_MSG_ERROR(Cannot build with kernel that does not have aops->write_begin()) + fi +fi + # End kapi_compat checks diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile index 86dabb1..817f9d2 100644 --- a/fs/ocfs2/Makefile +++ b/fs/ocfs2/Makefile @@ -48,6 +48,10 @@ ifdef NO_F_PATH_IN_STRUCT_FILE EXTRA_CFLAGS += -DNO_F_PATH_IN_STRUCT_FILE endif +ifdef ADDRESS_SPACE_OPS_EXT +EXTRA_CFLAGS += -DADDRESS_SPACE_OPS_EXT +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes. diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c index 67a3731..99ae9f0 100644 --- a/fs/ocfs2/aops.c +++ b/fs/ocfs2/aops.c @@ -2009,6 +2009,7 @@ static int ocfs2_write_end(struct file *file, struct address_space *mapping, return ret; } +#ifndef ADDRESS_SPACE_OPS_EXT const struct address_space_operations ocfs2_aops = { .readpage = ocfs2_readpage, .readpages = ocfs2_readpages, @@ -2024,3 +2025,18 @@ const struct address_space_operations ocfs2_aops = { .is_partially_uptodate = block_is_partially_uptodate, .error_remove_page = generic_error_remove_page, }; +#else +const struct address_space_operations_ext ocfs2_aops_ext = { + .orig_aops.readpage = ocfs2_readpage, + .orig_aops.readpages = ocfs2_readpages, + .orig_aops.writepage = ocfs2_writepage, + .write_begin = ocfs2_write_begin, + .write_end = ocfs2_write_end, + .orig_aops.bmap = ocfs2_bmap, + .orig_aops.sync_page = block_sync_page, + .orig_aops.direct_IO = ocfs2_direct_IO, + .orig_aops.invalidatepage = ocfs2_invalidatepage, + .orig_aops.releasepage = ocfs2_releasepage, + .orig_aops.migratepage = buffer_migrate_page, +}; +#endif diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c index 0297fb8..d38dcdd 100644 --- a/fs/ocfs2/inode.c +++ b/fs/ocfs2/inode.c @@ -285,7 +285,12 @@ void ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe, inode->i_blocks = 0; else inode->i_blocks = ocfs2_inode_sector_count(inode); +#ifndef ADDRESS_SPACE_OPS_EXT inode->i_mapping->a_ops = &ocfs2_aops; +#else + inode->i_mapping->a_ops = + (struct address_space_operations *)&ocfs2_aops_ext; +#endif inode->i_atime.tv_sec = le64_to_cpu(fe->i_atime); inode->i_atime.tv_nsec = le32_to_cpu(fe->i_atime_nsec); inode->i_mtime.tv_sec = le64_to_cpu(fe->i_mtime); diff --git a/fs/ocfs2/inode.h b/fs/ocfs2/inode.h index ba4fe07..c7db724 100644 --- a/fs/ocfs2/inode.h +++ b/fs/ocfs2/inode.h @@ -111,7 +111,11 @@ static inline struct ocfs2_inode_info *OCFS2_I(struct inode *inode) extern struct kmem_cache *ocfs2_inode_cache; +#ifndef ADDRESS_SPACE_OPS_EXT extern const struct address_space_operations ocfs2_aops; +#else +extern const struct address_space_operations_ext ocfs2_aops_ext; +#endif extern const struct ocfs2_caching_operations ocfs2_inode_caching_ops; static inline struct ocfs2_caching_info *INODE_CACHE(struct inode *inode) diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 5f19ff5..8c8b206 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c @@ -1044,6 +1044,10 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | ((osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0); +#ifdef ADDRESS_SPACE_OPS_EXT + sb->s_flags |= MS_HAS_NEW_AOPS; +#endif + /* Hard readonly mode only if: bdev_read_only, MS_RDONLY, * heartbeat=none */ if (bdev_read_only(sb->s_bdev)) { -- 1.5.6.5 From sunil.mushran at oracle.com Mon Nov 9 18:00:09 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Mon, 9 Nov 2009 18:00:09 -0800 Subject: [Ocfs2-devel] [PATCH 06/10] ocfs2: Handle missing do_sync_mapping_range() In-Reply-To: <1257818413-32014-1-git-send-email-sunil.mushran@oracle.com> References: <1257818413-32014-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1257818413-32014-7-git-send-email-sunil.mushran@oracle.com> Mainline commit 5b04aa3a64f854244bc40a6f528176ed50b5c4f6 added do_sync_mapping_range(). EL5 has do_sync_file_range(). This patch wires do_sync_mapping_range() into do_sync_file_range(). Build fails if both symbols are not found. Signed-off-by: Sunil Mushran --- Makefile | 3 ++- configure.in | 13 +++++++++++++ kapi-compat/include/sync_mapping.h | 13 +++++++++++++ 3 files changed, 28 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/sync_mapping.h diff --git a/Makefile b/Makefile index 950d6fc..8e58c5d 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/workqueue.h \ kapi-compat/include/dlmconstants.h \ kapi-compat/include/task_pid_nr.h \ - kapi-compat/include/current_umask.h + kapi-compat/include/current_umask.h \ + kapi-compat/include/sync_mapping.h PATCH_FILES = diff --git a/configure.in b/configure.in index 93f9632..658cd6f 100644 --- a/configure.in +++ b/configure.in @@ -180,6 +180,19 @@ OCFS2_CHECK_KERNEL([current_umask() in fs.h], fs.h, , current_umask_compat_header="current_umask.h", [^extern int current_umask(void)]) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $current_umask_compat_header" +do_sync_mapping_range= +OCFS2_CHECK_KERNEL([do_sync_mapping_range() in fs.h], fs.h, +do_sync_mapping_range="yes", , [int do_sync_mapping_range(struct address_space \*mapping]) +if test "x$do_sync_mapping_range" = "x" ; then + do_sync_file_range= + OCFS2_CHECK_KERNEL([ do_sync_file_range() in fs.h], fs.h, + do_sync_file_range="yes", , [int do_sync_file_range(struct file \*file]) + if test "x$do_sync_file_range" = "x" ; then + AC_MSG_ERROR(Cannot build with kernel that is missing both do_sync_mapping_range() and do_sync_file_range()) + fi + KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS sync_mapping.h" +fi + # End kapi_compat checks diff --git a/kapi-compat/include/sync_mapping.h b/kapi-compat/include/sync_mapping.h new file mode 100644 index 0000000..5d77feb --- /dev/null +++ b/kapi-compat/include/sync_mapping.h @@ -0,0 +1,13 @@ +#ifndef KAPI_SYNC_MAPPING_H +#define KAPI_SYNC_MAPPING_H + +#include +static inline int do_sync_mapping_range(struct address_space *mapping, + loff_t offset, loff_t endbyte, + unsigned int flags) +{ + struct file fake = { .f_mapping = mapping, }; + return do_sync_file_range(&fake, offset, endbyte, flags); +} + +#endif -- 1.5.6.5 From sunil.mushran at oracle.com Mon Nov 9 18:00:13 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Mon, 9 Nov 2009 18:00:13 -0800 Subject: [Ocfs2-devel] [PATCH 10/10] ocfs2: Handle different f_version types In-Reply-To: <1257818413-32014-1-git-send-email-sunil.mushran@oracle.com> References: <1257818413-32014-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1257818413-32014-11-git-send-email-sunil.mushran@oracle.com> Mainline commit 2b47c3611de05c585e2d81204f6c7e3e255a3461 changed type of file->f_version from unsigned long to u64. This patch allows building with kernels having either definition. Build fails if the type is something else. Signed-off-by: Sunil Mushran --- Config.make.in | 1 + Makefile | 3 ++- configure.in | 14 ++++++++++++++ fs/ocfs2/Makefile | 4 ++++ fs/ocfs2/dir.c | 12 ++++++------ kapi-compat/include/fversion.h | 10 ++++++++++ 6 files changed, 37 insertions(+), 7 deletions(-) create mode 100644 kapi-compat/include/fversion.h diff --git a/Config.make.in b/Config.make.in index aead755..ba72950 100644 --- a/Config.make.in +++ b/Config.make.in @@ -61,6 +61,7 @@ NO_DELAYED_WORK_STRUCT = @NO_DELAYED_WORK_STRUCT@ NO_DLMCONSTANTS_HEADER = @NO_DLMCONSTANTS_HEADER@ NO_F_PATH_IN_STRUCT_FILE = @NO_F_PATH_IN_STRUCT_FILE@ ADDRESS_SPACE_OPS_EXT = @ADDRESS_SPACE_OPS_EXT@ +FVERSION_IS_ULONG = @FVERSION_IS_ULONG@ OCFS_DEBUG = @OCFS_DEBUG@ diff --git a/Makefile b/Makefile index 6e28427..06ddabf 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/current_umask.h \ kapi-compat/include/sync_mapping.h \ kapi-compat/include/fpath.h \ - kapi-compat/include/ushortmax.h + kapi-compat/include/ushortmax.h \ + kapi-compat/include/fversion.h PATCH_FILES = diff --git a/configure.in b/configure.in index 4d9bea3..7ee2d34 100644 --- a/configure.in +++ b/configure.in @@ -217,6 +217,20 @@ OCFS2_CHECK_KERNEL([USHORT_MAX in kernel.h], kernel.h, , ushort_max_compat_header="ushortmax.h", [#define USHORT_MAX]) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $ushort_max_compat_header" +FVERSION_IS_ULONG= +OCFS2_CHECK_KERNEL([ f_version is type unsigned long in fs.h], fs.h, + FVERSION_IS_ULONG=yes, , [unsigned long.*f_version;]) +AC_SUBST(FVERSION_IS_ULONG) +if test "x$FVERSION_IS_ULONG" = "x" ; then + fversion_is_u64= + OCFS2_CHECK_KERNEL([ f_version is type u64 in fs.h], fs.h, + fversion_is_u64=yes, , [u64.*f_version;]) + if test "x$fversion_is_u64" = "x" ; then + AC_MSG_ERROR(Cannot build with kernel in which f_version type is neither unsigned long nor u64) + fi +fi +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS fversion.h" + # End kapi_compat checks diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile index 817f9d2..e6b5801 100644 --- a/fs/ocfs2/Makefile +++ b/fs/ocfs2/Makefile @@ -52,6 +52,10 @@ ifdef ADDRESS_SPACE_OPS_EXT EXTRA_CFLAGS += -DADDRESS_SPACE_OPS_EXT endif +ifdef FVERSION_IS_ULONG +EXTRA_CFLAGS += -DFVERSION_IS_ULONG +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes. diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c index 69b3402..b8991ac 100644 --- a/fs/ocfs2/dir.c +++ b/fs/ocfs2/dir.c @@ -1771,7 +1771,7 @@ bail: } static int ocfs2_dir_foreach_blk_id(struct inode *inode, - u64 *f_version, + f_version_t *f_version, loff_t *f_pos, void *priv, filldir_t filldir, int *filldir_err) { @@ -1832,7 +1832,7 @@ revalidate: * not the directory has been modified * during the copy operation. */ - u64 version = *f_version; + f_version_t version = *f_version; unsigned char d_type = DT_UNKNOWN; if (de->file_type < OCFS2_FT_MAX) @@ -1865,7 +1865,7 @@ out: * and indexed ones. */ static int ocfs2_dir_foreach_blk_el(struct inode *inode, - u64 *f_version, + f_version_t *f_version, loff_t *f_pos, void *priv, filldir_t filldir, int *filldir_err) { @@ -1952,7 +1952,7 @@ revalidate: * not the directory has been modified * during the copy operation. */ - unsigned long version = *f_version; + f_version_t version = *f_version; unsigned char d_type = DT_UNKNOWN; if (de->file_type < OCFS2_FT_MAX) @@ -1983,7 +1983,7 @@ out: return stored; } -static int ocfs2_dir_foreach_blk(struct inode *inode, u64 *f_version, +static int ocfs2_dir_foreach_blk(struct inode *inode, f_version_t *f_version, loff_t *f_pos, void *priv, filldir_t filldir, int *filldir_err) { @@ -2003,7 +2003,7 @@ int ocfs2_dir_foreach(struct inode *inode, loff_t *f_pos, void *priv, filldir_t filldir) { int ret = 0, filldir_err = 0; - u64 version = inode->i_version; + f_version_t version = inode->i_version; while (*f_pos < i_size_read(inode)) { ret = ocfs2_dir_foreach_blk(inode, &version, f_pos, priv, diff --git a/kapi-compat/include/fversion.h b/kapi-compat/include/fversion.h new file mode 100644 index 0000000..4977591 --- /dev/null +++ b/kapi-compat/include/fversion.h @@ -0,0 +1,10 @@ +#ifndef KAPI_FVERSION_H +#define KAPI_FVERSION_H + +#ifdef FVERSION_IS_ULONG +typedef unsigned long f_version_t; +#else +typedef u64 f_version_t; +#endif + +#endif -- 1.5.6.5 From sunil.mushran at oracle.com Mon Nov 9 18:00:05 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Mon, 9 Nov 2009 18:00:05 -0800 Subject: [Ocfs2-devel] [PATCH 02/10] ocfs2: Handle missing dlmconstants.h In-Reply-To: <1257818413-32014-1-git-send-email-sunil.mushran@oracle.com> References: <1257818413-32014-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1257818413-32014-3-git-send-email-sunil.mushran@oracle.com> Mainline commit d69a3ad6a0e47b2aa9b2b2ddfd385752132a4d34 split lock mode and flag constants from dlm.h into a sharable header, dlmconstants.h. This patch adds a header with the same name that merely includes dlm.h. Signed-off-by: Sunil Mushran --- Config.make.in | 1 + Makefile | 3 ++- configure.in | 6 ++++++ fs/ocfs2/Makefile | 4 ++++ fs/ocfs2/stackglue.h | 2 ++ kapi-compat/include/dlmconstants.h | 9 +++++++++ 6 files changed, 24 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/dlmconstants.h diff --git a/Config.make.in b/Config.make.in index cf292b6..33b7a89 100644 --- a/Config.make.in +++ b/Config.make.in @@ -58,6 +58,7 @@ MAKEBO_VERSION = @VERSION@ EXTRA_CFLAGS += @KAPI_COMPAT_CFLAGS@ NO_DELAYED_WORK_STRUCT = @NO_DELAYED_WORK_STRUCT@ +NO_DLMCONSTANTS_HEADER = @NO_DLMCONSTANTS_HEADER@ OCFS_DEBUG = @OCFS_DEBUG@ diff --git a/Makefile b/Makefile index 262bc49..d038ae9 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,8 @@ SUBDIRS = fs vendor LINUX_INCLUDE_FILES = KAPI_COMPAT_FILES = \ - kapi-compat/include/workqueue.h + kapi-compat/include/workqueue.h \ + kapi-compat/include/dlmconstants.h PATCH_FILES = diff --git a/configure.in b/configure.in index acbe098..f67de02 100644 --- a/configure.in +++ b/configure.in @@ -164,6 +164,12 @@ OCFS2_CHECK_KERNEL([struct delayed_work in workqueue.h], workqueue.h, AC_SUBST(NO_DELAYED_WORK_STRUCT) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS workqueue.h" +NO_DLMCONSTANTS_HEADER= +OCFS2_CHECK_KERNEL([dlmconstants.h], dlmconstants.h, + , NO_DLMCONSTANTS_HEADER=yes, [__DLMCONSTANTS_DOT_H__]) +AC_SUBST(NO_DLMCONSTANTS_HEADER) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS dlmconstants.h" + # End kapi_compat checks diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile index 4415ce6..e997fe4 100644 --- a/fs/ocfs2/Makefile +++ b/fs/ocfs2/Makefile @@ -38,6 +38,10 @@ ifdef NO_DELAYED_WORK_STRUCT EXTRA_CFLAGS += -DNO_DELAYED_WORK_STRUCT endif +ifdef NO_DLMCONSTANTS_HEADER +EXTRA_CFLAGS += -DNO_DLMCONSTANTS_HEADER +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes. diff --git a/fs/ocfs2/stackglue.h b/fs/ocfs2/stackglue.h index 03a44d6..52d1a1d 100644 --- a/fs/ocfs2/stackglue.h +++ b/fs/ocfs2/stackglue.h @@ -23,7 +23,9 @@ #include #include +#ifndef NO_DLMCONSTANTS_HEADER #include +#endif #include "dlm/dlmapi.h" #include diff --git a/kapi-compat/include/dlmconstants.h b/kapi-compat/include/dlmconstants.h new file mode 100644 index 0000000..19e92c9 --- /dev/null +++ b/kapi-compat/include/dlmconstants.h @@ -0,0 +1,9 @@ +#ifndef KAPI_DLMCONSTANTS_H +#define KAPI_DLMCONSTANTS_H + +#ifdef NO_DLMCONSTANTS_HEADER +#include +#include +#endif + +#endif -- 1.5.6.5 From sunil.mushran at oracle.com Mon Nov 9 18:00:04 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Mon, 9 Nov 2009 18:00:04 -0800 Subject: [Ocfs2-devel] [PATCH 01/10] ocfs2: Handle workqueue changes In-Reply-To: <1257818413-32014-1-git-send-email-sunil.mushran@oracle.com> References: <1257818413-32014-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1257818413-32014-2-git-send-email-sunil.mushran@oracle.com> Mainline commit 52bad64d95bd89e08c49ec5a071fa6dcbe5a1a9c introduced struct delayed_work to separate delayable and non-delayable work. Signed-off-by: Sunil Mushran --- Config.make.in | 2 + Makefile | 3 +- configure.in | 6 +++ fs/ocfs2/Makefile | 4 ++ fs/ocfs2/alloc.c | 11 +++--- fs/ocfs2/cluster/Makefile | 4 ++ fs/ocfs2/cluster/heartbeat.c | 10 +++--- fs/ocfs2/cluster/quorum.c | 4 +- fs/ocfs2/cluster/tcp.c | 65 ++++++++++++++++++++------------------ fs/ocfs2/dcache.c | 6 ++-- fs/ocfs2/dcache.h | 2 +- fs/ocfs2/dlm/Makefile | 4 ++ fs/ocfs2/dlm/dlmcommon.h | 2 +- fs/ocfs2/dlm/dlmdomain.c | 2 +- fs/ocfs2/dlm/dlmrecovery.c | 4 +- fs/ocfs2/dlm/userdlm.c | 9 +++-- fs/ocfs2/journal.c | 12 +++--- fs/ocfs2/journal.h | 2 +- fs/ocfs2/localalloc.c | 6 ++-- fs/ocfs2/localalloc.h | 2 +- fs/ocfs2/quota_global.c | 12 +++--- fs/ocfs2/super.c | 6 ++-- kapi-compat/include/workqueue.h | 17 ++++++++++ 23 files changed, 118 insertions(+), 77 deletions(-) create mode 100644 kapi-compat/include/workqueue.h diff --git a/Config.make.in b/Config.make.in index 4e008fb..cf292b6 100644 --- a/Config.make.in +++ b/Config.make.in @@ -57,6 +57,8 @@ MAKEBO_VERSION = @VERSION@ EXTRA_CFLAGS += @KAPI_COMPAT_CFLAGS@ +NO_DELAYED_WORK_STRUCT = @NO_DELAYED_WORK_STRUCT@ + OCFS_DEBUG = @OCFS_DEBUG@ diff --git a/Makefile b/Makefile index e335ac9..262bc49 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,8 @@ SUBDIRS = fs vendor LINUX_INCLUDE_FILES = -KAPI_COMPAT_FILES = +KAPI_COMPAT_FILES = \ + kapi-compat/include/workqueue.h PATCH_FILES = diff --git a/configure.in b/configure.in index ad06385..acbe098 100644 --- a/configure.in +++ b/configure.in @@ -158,6 +158,12 @@ esac # Begin kapi_compat checks +NO_DELAYED_WORK_STRUCT= +OCFS2_CHECK_KERNEL([struct delayed_work in workqueue.h], workqueue.h, + , NO_DELAYED_WORK_STRUCT=yes, [^struct delayed_work]) +AC_SUBST(NO_DELAYED_WORK_STRUCT) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS workqueue.h" + # End kapi_compat checks diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile index 8222d03..4415ce6 100644 --- a/fs/ocfs2/Makefile +++ b/fs/ocfs2/Makefile @@ -34,6 +34,10 @@ EXTRA_CFLAGS += -DCONFIG_OCFS2_DEBUG_MASKLOG EXTRA_CFLAGS += -DCONFIG_OCFS2_FS_STATS +ifdef NO_DELAYED_WORK_STRUCT +EXTRA_CFLAGS += -DNO_DELAYED_WORK_STRUCT +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes. diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index 38a42f5..a1cfe4b 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c @@ -6024,12 +6024,11 @@ int ocfs2_flush_truncate_log(struct ocfs2_super *osb) return status; } -static void ocfs2_truncate_log_worker(struct work_struct *work) +static void ocfs2_truncate_log_worker(kapi_work_struct_t *work) { int status; - struct ocfs2_super *osb = - container_of(work, struct ocfs2_super, - osb_truncate_log_wq.work); + struct ocfs2_super *osb = work_to_object(work, struct ocfs2_super, + osb_truncate_log_wq.work); mlog_entry_void(); @@ -6262,8 +6261,8 @@ int ocfs2_truncate_log_init(struct ocfs2_super *osb) /* ocfs2_truncate_log_shutdown keys on the existence of * osb->osb_tl_inode so we don't set any of the osb variables * until we're sure all is well. */ - INIT_DELAYED_WORK(&osb->osb_truncate_log_wq, - ocfs2_truncate_log_worker); + KAPI_INIT_DELAYED_WORK(&osb->osb_truncate_log_wq, + ocfs2_truncate_log_worker, osb); osb->osb_tl_bh = tl_bh; osb->osb_tl_inode = tl_inode; diff --git a/fs/ocfs2/cluster/Makefile b/fs/ocfs2/cluster/Makefile index fc5d3a0..c1f4f31 100644 --- a/fs/ocfs2/cluster/Makefile +++ b/fs/ocfs2/cluster/Makefile @@ -18,6 +18,10 @@ HEADERS = EXTRA_CFLAGS += -DCONFIG_OCFS2_DEBUG_MASKLOG +ifdef NO_DELAYED_WORK_STRUCT +EXTRA_CFLAGS += -DNO_DELAYED_WORK_STRUCT +endif + SOURCES += \ heartbeat.c \ masklog.c \ diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c index c452d11..68e9af5 100644 --- a/fs/ocfs2/cluster/heartbeat.c +++ b/fs/ocfs2/cluster/heartbeat.c @@ -162,11 +162,10 @@ struct o2hb_bio_wait_ctxt { int wc_error; }; -static void o2hb_write_timeout(struct work_struct *work) +static void o2hb_write_timeout(kapi_work_struct_t *work) { - struct o2hb_region *reg = - container_of(work, struct o2hb_region, - hr_write_timeout_work.work); + struct o2hb_region *reg = work_to_object(work, struct o2hb_region, + hr_write_timeout_work.work); mlog(ML_ERROR, "Heartbeat write timeout to device %s after %u " "milliseconds\n", reg->hr_dev_name, @@ -1400,7 +1399,8 @@ static ssize_t o2hb_region_dev_write(struct o2hb_region *reg, goto out; } - INIT_DELAYED_WORK(®->hr_write_timeout_work, o2hb_write_timeout); + KAPI_INIT_DELAYED_WORK(®->hr_write_timeout_work, o2hb_write_timeout, + reg); /* * A node is considered live after it has beat LIVE_THRESHOLD diff --git a/fs/ocfs2/cluster/quorum.c b/fs/ocfs2/cluster/quorum.c index bbacf7d..242622f 100644 --- a/fs/ocfs2/cluster/quorum.c +++ b/fs/ocfs2/cluster/quorum.c @@ -91,7 +91,7 @@ void o2quo_disk_timeout(void) o2quo_fence_self(); } -static void o2quo_make_decision(struct work_struct *work) +static void o2quo_make_decision(kapi_work_struct_t *work) { int quorum; int lowest_hb, lowest_reachable = 0, fence = 0; @@ -309,7 +309,7 @@ void o2quo_init(void) struct o2quo_state *qs = &o2quo_state; spin_lock_init(&qs->qs_lock); - INIT_WORK(&qs->qs_work, o2quo_make_decision); + KAPI_INIT_WORK(&qs->qs_work, o2quo_make_decision, qs); } void o2quo_exit(void) diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c index 334f231..4b8279e 100644 --- a/fs/ocfs2/cluster/tcp.c +++ b/fs/ocfs2/cluster/tcp.c @@ -133,11 +133,11 @@ static int o2net_sys_err_translations[O2NET_ERR_MAX] = [O2NET_ERR_DIED] = -EHOSTDOWN,}; /* can't quite avoid *all* internal declarations :/ */ -static void o2net_sc_connect_completed(struct work_struct *work); -static void o2net_rx_until_empty(struct work_struct *work); -static void o2net_shutdown_sc(struct work_struct *work); +static void o2net_sc_connect_completed(kapi_work_struct_t *work); +static void o2net_rx_until_empty(kapi_work_struct_t *work); +static void o2net_shutdown_sc(kapi_work_struct_t *work); static void o2net_listen_data_ready(struct sock *sk, int bytes); -static void o2net_sc_send_keep_req(struct work_struct *work); +static void o2net_sc_send_keep_req(kapi_work_struct_t *work); static void o2net_idle_timer(unsigned long data); static void o2net_sc_postpone_idle(struct o2net_sock_container *sc); static void o2net_sc_reset_idle_timer(struct o2net_sock_container *sc); @@ -386,10 +386,11 @@ static struct o2net_sock_container *sc_alloc(struct o2nm_node *node) o2nm_node_get(node); sc->sc_node = node; - INIT_WORK(&sc->sc_connect_work, o2net_sc_connect_completed); - INIT_WORK(&sc->sc_rx_work, o2net_rx_until_empty); - INIT_WORK(&sc->sc_shutdown_work, o2net_shutdown_sc); - INIT_DELAYED_WORK(&sc->sc_keepalive_work, o2net_sc_send_keep_req); + KAPI_INIT_WORK(&sc->sc_connect_work, o2net_sc_connect_completed, sc); + KAPI_INIT_WORK(&sc->sc_rx_work, o2net_rx_until_empty, sc); + KAPI_INIT_WORK(&sc->sc_shutdown_work, o2net_shutdown_sc, sc); + KAPI_INIT_DELAYED_WORK(&sc->sc_keepalive_work, o2net_sc_send_keep_req, + sc); init_timer(&sc->sc_idle_timeout); sc->sc_idle_timeout.function = o2net_idle_timer; @@ -662,11 +663,11 @@ static void o2net_ensure_shutdown(struct o2net_node *nn, * ourselves as state_change couldn't get the nn_lock and call set_nn_state * itself. */ -static void o2net_shutdown_sc(struct work_struct *work) +static void o2net_shutdown_sc(kapi_work_struct_t *work) { struct o2net_sock_container *sc = - container_of(work, struct o2net_sock_container, - sc_shutdown_work); + work_to_object(work, struct o2net_sock_container, + sc_shutdown_work); struct o2net_node *nn = o2net_nn_from_num(sc->sc_node->nd_num); sclog(sc, "shutting down\n"); @@ -1379,10 +1380,10 @@ out: /* this work func is triggerd by data ready. it reads until it can read no * more. it interprets 0, eof, as fatal. if data_ready hits while we're doing * our work the work struct will be marked and we'll be called again. */ -static void o2net_rx_until_empty(struct work_struct *work) +static void o2net_rx_until_empty(kapi_work_struct_t *work) { struct o2net_sock_container *sc = - container_of(work, struct o2net_sock_container, sc_rx_work); + work_to_object(work, struct o2net_sock_container, sc_rx_work); int ret; do { @@ -1439,11 +1440,11 @@ static void o2net_initialize_handshake(void) /* called when a connect completes and after a sock is accepted. the * rx path will see the response and mark the sc valid */ -static void o2net_sc_connect_completed(struct work_struct *work) +static void o2net_sc_connect_completed(kapi_work_struct_t *work) { struct o2net_sock_container *sc = - container_of(work, struct o2net_sock_container, - sc_connect_work); + work_to_object(work, struct o2net_sock_container, + sc_connect_work); mlog(ML_MSG, "sc sending handshake with ver %llu id %llx\n", (unsigned long long)O2NET_PROTOCOL_VERSION, @@ -1455,11 +1456,11 @@ static void o2net_sc_connect_completed(struct work_struct *work) } /* this is called as a work_struct func. */ -static void o2net_sc_send_keep_req(struct work_struct *work) +static void o2net_sc_send_keep_req(kapi_work_struct_t *work) { struct o2net_sock_container *sc = - container_of(work, struct o2net_sock_container, - sc_keepalive_work.work); + work_to_object(work, struct o2net_sock_container, + sc_keepalive_work.work); o2net_sendpage(sc, o2net_keep_req, sizeof(*o2net_keep_req)); sc_put(sc); @@ -1525,10 +1526,10 @@ static void o2net_sc_postpone_idle(struct o2net_sock_container *sc) * having a connect attempt fail, etc. This centralizes the logic which decides * if a connect attempt should be made or if we should give up and all future * transmit attempts should fail */ -static void o2net_start_connect(struct work_struct *work) +static void o2net_start_connect(kapi_work_struct_t *work) { struct o2net_node *nn = - container_of(work, struct o2net_node, nn_connect_work.work); + work_to_object(work, struct o2net_node, nn_connect_work.work); struct o2net_sock_container *sc = NULL; struct o2nm_node *node = NULL, *mynode = NULL; struct socket *sock = NULL; @@ -1642,10 +1643,11 @@ out: return; } -static void o2net_connect_expired(struct work_struct *work) +static void o2net_connect_expired(kapi_work_struct_t *work) { struct o2net_node *nn = - container_of(work, struct o2net_node, nn_connect_expired.work); + work_to_object(work, struct o2net_node, + nn_connect_expired.work); spin_lock(&nn->nn_lock); if (!nn->nn_sc_valid) { @@ -1660,10 +1662,10 @@ static void o2net_connect_expired(struct work_struct *work) spin_unlock(&nn->nn_lock); } -static void o2net_still_up(struct work_struct *work) +static void o2net_still_up(kapi_work_struct_t *work) { struct o2net_node *nn = - container_of(work, struct o2net_node, nn_still_up.work); + work_to_object(work, struct o2net_node, nn_still_up.work); o2quo_hb_still_up(o2net_num_from_nn(nn)); } @@ -1859,7 +1861,7 @@ out: return ret; } -static void o2net_accept_many(struct work_struct *work) +static void o2net_accept_many(kapi_work_struct_t *work) { struct socket *sock = o2net_listen_sock; while (o2net_accept_one(sock) == 0) @@ -1915,7 +1917,7 @@ static int o2net_open_listening_sock(__be32 addr, __be16 port) write_unlock_bh(&sock->sk->sk_callback_lock); o2net_listen_sock = sock; - INIT_WORK(&o2net_listen_work, o2net_accept_many); + KAPI_INIT_WORK(&o2net_listen_work, o2net_accept_many, sock); sock->sk->sk_reuse = 1; ret = sock->ops->bind(sock, (struct sockaddr *)&sin, sizeof(sin)); @@ -2039,10 +2041,11 @@ int o2net_init(void) atomic_set(&nn->nn_timeout, 0); spin_lock_init(&nn->nn_lock); - INIT_DELAYED_WORK(&nn->nn_connect_work, o2net_start_connect); - INIT_DELAYED_WORK(&nn->nn_connect_expired, - o2net_connect_expired); - INIT_DELAYED_WORK(&nn->nn_still_up, o2net_still_up); + KAPI_INIT_DELAYED_WORK(&nn->nn_connect_work, + o2net_start_connect, nn); + KAPI_INIT_DELAYED_WORK(&nn->nn_connect_expired, + o2net_connect_expired, nn); + KAPI_INIT_DELAYED_WORK(&nn->nn_still_up, o2net_still_up, nn); /* until we see hb from a node we'll return einval */ nn->nn_persistent_error = -ENOTCONN; init_waitqueue_head(&nn->nn_sc_wq); diff --git a/fs/ocfs2/dcache.c b/fs/ocfs2/dcache.c index b4957c7..8ad82bc 100644 --- a/fs/ocfs2/dcache.c +++ b/fs/ocfs2/dcache.c @@ -344,10 +344,10 @@ static void __ocfs2_drop_dl_inodes(struct ocfs2_super *osb, int drop_count) spin_unlock(&dentry_list_lock); } -void ocfs2_drop_dl_inodes(struct work_struct *work) +void ocfs2_drop_dl_inodes(kapi_work_struct_t *work) { - struct ocfs2_super *osb = container_of(work, struct ocfs2_super, - dentry_lock_work); + struct ocfs2_super *osb = work_to_object(work, struct ocfs2_super, + dentry_lock_work); __ocfs2_drop_dl_inodes(osb, DL_INODE_DROP_COUNT); /* diff --git a/fs/ocfs2/dcache.h b/fs/ocfs2/dcache.h index f5dd178..d13a087 100644 --- a/fs/ocfs2/dcache.h +++ b/fs/ocfs2/dcache.h @@ -54,7 +54,7 @@ extern spinlock_t dentry_list_lock; void ocfs2_dentry_lock_put(struct ocfs2_super *osb, struct ocfs2_dentry_lock *dl); -void ocfs2_drop_dl_inodes(struct work_struct *work); +void ocfs2_drop_dl_inodes(kapi_work_struct_t *work); void ocfs2_drop_all_dl_inodes(struct ocfs2_super *osb); struct dentry *ocfs2_find_local_alias(struct inode *inode, u64 parent_blkno, diff --git a/fs/ocfs2/dlm/Makefile b/fs/ocfs2/dlm/Makefile index 26cbf6c..44b6cc6 100644 --- a/fs/ocfs2/dlm/Makefile +++ b/fs/ocfs2/dlm/Makefile @@ -22,6 +22,10 @@ EXTRA_CFLAGS += -I$(OUR_TOPDIR)/fs/ocfs2 EXTRA_CFLAGS += -DCONFIG_OCFS2_DEBUG_MASKLOG +ifdef NO_DELAYED_WORK_STRUCT +EXTRA_CFLAGS += -DNO_DELAYED_WORK_STRUCT +endif + DLM_SOURCES += \ dlmast.c \ dlmconvert.c \ diff --git a/fs/ocfs2/dlm/dlmcommon.h b/fs/ocfs2/dlm/dlmcommon.h index 0102be3..a13292a 100644 --- a/fs/ocfs2/dlm/dlmcommon.h +++ b/fs/ocfs2/dlm/dlmcommon.h @@ -203,7 +203,7 @@ static inline struct hlist_head *dlm_master_hash(struct dlm_ctxt *dlm, * called functions that cannot be directly called from the * net message handlers for some reason, usually because * they need to send net messages of their own. */ -void dlm_dispatch_work(struct work_struct *work); +void dlm_dispatch_work(kapi_work_struct_t *work); struct dlm_lock_resource; struct dlm_work_item; diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c index 0334000..05a0350 100644 --- a/fs/ocfs2/dlm/dlmdomain.c +++ b/fs/ocfs2/dlm/dlmdomain.c @@ -1613,7 +1613,7 @@ static struct dlm_ctxt *dlm_alloc_ctxt(const char *domain, spin_lock_init(&dlm->work_lock); INIT_LIST_HEAD(&dlm->work_list); - INIT_WORK(&dlm->dispatched_work, dlm_dispatch_work); + KAPI_INIT_WORK(&dlm->dispatched_work, dlm_dispatch_work, dlm); kref_init(&dlm->dlm_refs); dlm->dlm_state = DLM_CTXT_NEW; diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c index d9fa3d2..2e16a38 100644 --- a/fs/ocfs2/dlm/dlmrecovery.c +++ b/fs/ocfs2/dlm/dlmrecovery.c @@ -152,10 +152,10 @@ static inline void dlm_reset_recovery(struct dlm_ctxt *dlm) } /* Worker function used during recovery. */ -void dlm_dispatch_work(struct work_struct *work) +void dlm_dispatch_work(kapi_work_struct_t *work) { struct dlm_ctxt *dlm = - container_of(work, struct dlm_ctxt, dispatched_work); + work_to_object(work, struct dlm_ctxt, dispatched_work); LIST_HEAD(tmp_list); struct dlm_work_item *item, *next; dlm_workfunc_t *workfunc; diff --git a/fs/ocfs2/dlm/userdlm.c b/fs/ocfs2/dlm/userdlm.c index 4cb1d3d..01a57c8 100644 --- a/fs/ocfs2/dlm/userdlm.c +++ b/fs/ocfs2/dlm/userdlm.c @@ -171,14 +171,15 @@ static inline void user_dlm_grab_inode_ref(struct user_lock_res *lockres) BUG(); } -static void user_dlm_unblock_lock(struct work_struct *work); +static void user_dlm_unblock_lock(kapi_work_struct_t *work); static void __user_dlm_queue_lockres(struct user_lock_res *lockres) { if (!(lockres->l_flags & USER_LOCK_QUEUED)) { user_dlm_grab_inode_ref(lockres); - INIT_WORK(&lockres->l_work, user_dlm_unblock_lock); + KAPI_INIT_WORK(&lockres->l_work, user_dlm_unblock_lock, + lockres); queue_work(user_dlm_worker, &lockres->l_work); lockres->l_flags |= USER_LOCK_QUEUED; @@ -278,11 +279,11 @@ static inline void user_dlm_drop_inode_ref(struct user_lock_res *lockres) iput(inode); } -static void user_dlm_unblock_lock(struct work_struct *work) +static void user_dlm_unblock_lock(kapi_work_struct_t *work) { int new_level, status; struct user_lock_res *lockres = - container_of(work, struct user_lock_res, l_work); + work_to_object(work, struct user_lock_res, l_work); struct dlm_ctxt *dlm = dlm_ctxt_from_user_lockres(lockres); mlog(0, "processing lockres %.*s\n", lockres->l_namelen, diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c index 54c16b6..67cc5a7 100644 --- a/fs/ocfs2/journal.c +++ b/fs/ocfs2/journal.c @@ -1189,11 +1189,11 @@ struct ocfs2_la_recovery_item { * NOTE: This function can and will sleep on recovery of other nodes * during cluster locking, just like any other ocfs2 process. */ -void ocfs2_complete_recovery(struct work_struct *work) +void ocfs2_complete_recovery(kapi_work_struct_t *work) { int ret; struct ocfs2_journal *journal = - container_of(work, struct ocfs2_journal, j_recovery_work); + work_to_object(work, struct ocfs2_journal, j_recovery_work); struct ocfs2_super *osb = journal->j_osb; struct ocfs2_dinode *la_dinode, *tl_dinode; struct ocfs2_la_recovery_item *item, *n; @@ -1926,13 +1926,13 @@ out: } /* Worker task that gets fired every ORPHAN_SCAN_SCHEDULE_TIMEOUT millsec */ -void ocfs2_orphan_scan_work(struct work_struct *work) +void ocfs2_orphan_scan_work(kapi_work_struct_t *work) { struct ocfs2_orphan_scan *os; struct ocfs2_super *osb; - os = container_of(work, struct ocfs2_orphan_scan, - os_orphan_scan_work.work); + os = work_to_object(work, struct ocfs2_orphan_scan, + os_orphan_scan_work.work); osb = os->os_osb; mutex_lock(&os->os_lock); @@ -1965,7 +1965,7 @@ void ocfs2_orphan_scan_init(struct ocfs2_super *osb) os->os_count = 0; os->os_seqno = 0; mutex_init(&os->os_lock); - INIT_DELAYED_WORK(&os->os_orphan_scan_work, ocfs2_orphan_scan_work); + KAPI_INIT_DELAYED_WORK(&os->os_orphan_scan_work, ocfs2_orphan_scan_work, os); } void ocfs2_orphan_scan_start(struct ocfs2_super *osb) diff --git a/fs/ocfs2/journal.h b/fs/ocfs2/journal.h index 3f74e09..321c857 100644 --- a/fs/ocfs2/journal.h +++ b/fs/ocfs2/journal.h @@ -159,7 +159,7 @@ void ocfs2_orphan_scan_start(struct ocfs2_super *osb); void ocfs2_orphan_scan_stop(struct ocfs2_super *osb); void ocfs2_orphan_scan_exit(struct ocfs2_super *osb); -void ocfs2_complete_recovery(struct work_struct *work); +void ocfs2_complete_recovery(kapi_work_struct_t *work); void ocfs2_wait_for_recovery(struct ocfs2_super *osb); int ocfs2_recovery_init(struct ocfs2_super *osb); diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c index ac10f83..83b22ca 100644 --- a/fs/ocfs2/localalloc.c +++ b/fs/ocfs2/localalloc.c @@ -93,11 +93,11 @@ void ocfs2_local_alloc_seen_free_bits(struct ocfs2_super *osb, spin_unlock(&osb->osb_lock); } -void ocfs2_la_enable_worker(struct work_struct *work) +void ocfs2_la_enable_worker(kapi_work_struct_t *work) { struct ocfs2_super *osb = - container_of(work, struct ocfs2_super, - la_enable_wq.work); + work_to_object(work, struct ocfs2_super, + la_enable_wq.work); spin_lock(&osb->osb_lock); osb->local_alloc_state = OCFS2_LA_ENABLED; spin_unlock(&osb->osb_lock); diff --git a/fs/ocfs2/localalloc.h b/fs/ocfs2/localalloc.h index ac5ea9f..3234d2a 100644 --- a/fs/ocfs2/localalloc.h +++ b/fs/ocfs2/localalloc.h @@ -54,6 +54,6 @@ int ocfs2_claim_local_alloc_bits(struct ocfs2_super *osb, void ocfs2_local_alloc_seen_free_bits(struct ocfs2_super *osb, unsigned int num_clusters); -void ocfs2_la_enable_worker(struct work_struct *work); +void ocfs2_la_enable_worker(kapi_work_struct_t *work); #endif /* OCFS2_LOCALALLOC_H */ diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c index b437dc0..0f319fb 100644 --- a/fs/ocfs2/quota_global.c +++ b/fs/ocfs2/quota_global.c @@ -28,7 +28,7 @@ static struct workqueue_struct *ocfs2_quota_wq = NULL; -static void qsync_work_fn(struct work_struct *work); +static void qsync_work_fn(kapi_work_struct_t *work); static void ocfs2_global_disk2memdqb(struct dquot *dquot, void *dp) { @@ -360,7 +360,7 @@ int ocfs2_global_read_info(struct super_block *sb, int type) oinfo->dqi_gi.dqi_usable_bs = sb->s_blocksize - OCFS2_QBLK_RESERVED_SPACE; oinfo->dqi_gi.dqi_qtree_depth = qtree_depth(&oinfo->dqi_gi); - INIT_DELAYED_WORK(&oinfo->dqi_sync_work, qsync_work_fn); + KAPI_INIT_DELAYED_WORK(&oinfo->dqi_sync_work, qsync_work_fn, oinfo); queue_delayed_work(ocfs2_quota_wq, &oinfo->dqi_sync_work, msecs_to_jiffies(oinfo->dqi_syncms)); @@ -653,11 +653,11 @@ out: return status; } -static void qsync_work_fn(struct work_struct *work) +static void qsync_work_fn(kapi_work_struct_t *work) { - struct ocfs2_mem_dqinfo *oinfo = container_of(work, - struct ocfs2_mem_dqinfo, - dqi_sync_work.work); + struct ocfs2_mem_dqinfo *oinfo = + work_to_object(work, struct ocfs2_mem_dqinfo, + dqi_sync_work.work); struct super_block *sb = oinfo->dqi_gqinode->i_sb; dquot_scan_active(sb, ocfs2_sync_dquot_helper, oinfo->dqi_type); diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index c0e48ae..5f19ff5 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c @@ -2027,7 +2027,7 @@ static int ocfs2_initialize_super(struct super_block *sb, osb->local_alloc_state = OCFS2_LA_UNUSED; osb->local_alloc_bh = NULL; - INIT_DELAYED_WORK(&osb->la_enable_wq, ocfs2_la_enable_worker); + KAPI_INIT_DELAYED_WORK(&osb->la_enable_wq, ocfs2_la_enable_worker, osb); init_waitqueue_head(&osb->osb_mount_event); @@ -2134,10 +2134,10 @@ static int ocfs2_initialize_super(struct super_block *sb, spin_lock_init(&journal->j_lock); journal->j_trans_id = (unsigned long) 1; INIT_LIST_HEAD(&journal->j_la_cleanups); - INIT_WORK(&journal->j_recovery_work, ocfs2_complete_recovery); + KAPI_INIT_WORK(&journal->j_recovery_work, ocfs2_complete_recovery, journal); journal->j_state = OCFS2_JOURNAL_FREE; - INIT_WORK(&osb->dentry_lock_work, ocfs2_drop_dl_inodes); + KAPI_INIT_WORK(&osb->dentry_lock_work, ocfs2_drop_dl_inodes, osb); osb->dentry_lock_list = NULL; /* get some pseudo constants for clustersize bits */ diff --git a/kapi-compat/include/workqueue.h b/kapi-compat/include/workqueue.h new file mode 100644 index 0000000..24dfe2d --- /dev/null +++ b/kapi-compat/include/workqueue.h @@ -0,0 +1,17 @@ +#ifndef KAPI_WORKQUEUE_H +#define KAPI_WORKQUEUE_H + +#ifdef NO_DELAYED_WORK_STRUCT +# define delayed_work work_struct +typedef void kapi_work_struct_t; +# define work_to_object(a, b, c) (a) +# define KAPI_INIT_WORK(a, b, c) INIT_WORK(a, b, c) +# define KAPI_INIT_DELAYED_WORK(a, b, c) INIT_WORK(a, b, c) +#else +typedef struct work_struct kapi_work_struct_t; +# define work_to_object(a, b, c) container_of(a, b, c) +# define KAPI_INIT_WORK(a, b, c) INIT_WORK(a, b) +# define KAPI_INIT_DELAYED_WORK(a, b, c) INIT_DELAYED_WORK(a, b) +#endif + +#endif -- 1.5.6.5 From sunil.mushran at oracle.com Mon Nov 9 18:00:03 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Mon, 9 Nov 2009 18:00:03 -0800 Subject: [Ocfs2-devel] ocfs2 1.6 - second set of patches Message-ID: <1257818413-32014-1-git-send-email-sunil.mushran@oracle.com> The second set of patches. From sunil.mushran at oracle.com Mon Nov 9 18:00:06 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Mon, 9 Nov 2009 18:00:06 -0800 Subject: [Ocfs2-devel] [PATCH 03/10] ocfs2: Add helper task_pid_nr() In-Reply-To: <1257818413-32014-1-git-send-email-sunil.mushran@oracle.com> References: <1257818413-32014-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1257818413-32014-4-git-send-email-sunil.mushran@oracle.com> Mainline commit 7af5729474b5b8ad385adadab78d6e723e7655a3 added a helper to obtain the pid number. Signed-off-by: Sunil Mushran --- Makefile | 3 ++- configure.in | 5 +++++ kapi-compat/include/task_pid_nr.h | 12 ++++++++++++ 3 files changed, 19 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/task_pid_nr.h diff --git a/Makefile b/Makefile index d038ae9..98726c9 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,8 @@ LINUX_INCLUDE_FILES = KAPI_COMPAT_FILES = \ kapi-compat/include/workqueue.h \ - kapi-compat/include/dlmconstants.h + kapi-compat/include/dlmconstants.h \ + kapi-compat/include/task_pid_nr.h PATCH_FILES = diff --git a/configure.in b/configure.in index f67de02..e94412b 100644 --- a/configure.in +++ b/configure.in @@ -170,6 +170,11 @@ OCFS2_CHECK_KERNEL([dlmconstants.h], dlmconstants.h, AC_SUBST(NO_DLMCONSTANTS_HEADER) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS dlmconstants.h" +task_pid_nr_compat_header= +OCFS2_CHECK_KERNEL([task_pid_nr() in sched.h], sched.h, + , task_pid_nr_compat_header="task_pid_nr.h", [^static inline pid_t task_pid_nr(struct]) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $task_pid_nr_compat_header" + # End kapi_compat checks diff --git a/kapi-compat/include/task_pid_nr.h b/kapi-compat/include/task_pid_nr.h new file mode 100644 index 0000000..bd69a75 --- /dev/null +++ b/kapi-compat/include/task_pid_nr.h @@ -0,0 +1,12 @@ +#ifndef KAPI_TASK_PID_NR_H +#define KAPI_TASK_PID_NR_H + +#include +#include + +static inline pid_t task_pid_nr(struct task_struct *tsk) +{ + return tsk->pid; +} + +#endif -- 1.5.6.5 From sunil.mushran at oracle.com Mon Nov 9 18:00:10 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Mon, 9 Nov 2009 18:00:10 -0800 Subject: [Ocfs2-devel] [PATCH 07/10] ocfs2: Handle struct f_path in struct file In-Reply-To: <1257818413-32014-1-git-send-email-sunil.mushran@oracle.com> References: <1257818413-32014-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1257818413-32014-8-git-send-email-sunil.mushran@oracle.com> Mainline commit 0f7fc9e4d03987fe29f6dd4aa67e4c56eb7ecb05 added struct path into struct file. Signed-off-by: Sunil Mushran --- Config.make.in | 1 + Makefile | 3 ++- configure.in | 6 ++++++ fs/ocfs2/Makefile | 4 ++++ fs/ocfs2/aops.c | 4 ++-- fs/ocfs2/dir.c | 2 +- fs/ocfs2/dlm/Makefile | 4 ++++ fs/ocfs2/dlm/dlmfs.c | 4 ++-- fs/ocfs2/file.c | 36 ++++++++++++++++++------------------ fs/ocfs2/ioctl.c | 6 +++--- fs/ocfs2/mmap.c | 8 ++++---- kapi-compat/include/fpath.h | 12 ++++++++++++ 12 files changed, 59 insertions(+), 31 deletions(-) create mode 100644 kapi-compat/include/fpath.h diff --git a/Config.make.in b/Config.make.in index 33b7a89..eb8e2a9 100644 --- a/Config.make.in +++ b/Config.make.in @@ -59,6 +59,7 @@ EXTRA_CFLAGS += @KAPI_COMPAT_CFLAGS@ NO_DELAYED_WORK_STRUCT = @NO_DELAYED_WORK_STRUCT@ NO_DLMCONSTANTS_HEADER = @NO_DLMCONSTANTS_HEADER@ +NO_F_PATH_IN_STRUCT_FILE = @NO_F_PATH_IN_STRUCT_FILE@ OCFS_DEBUG = @OCFS_DEBUG@ diff --git a/Makefile b/Makefile index 8e58c5d..6a28531 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/dlmconstants.h \ kapi-compat/include/task_pid_nr.h \ kapi-compat/include/current_umask.h \ - kapi-compat/include/sync_mapping.h + kapi-compat/include/sync_mapping.h \ + kapi-compat/include/fpath.h PATCH_FILES = diff --git a/configure.in b/configure.in index 658cd6f..e29e6df 100644 --- a/configure.in +++ b/configure.in @@ -193,6 +193,12 @@ if test "x$do_sync_mapping_range" = "x" ; then KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS sync_mapping.h" fi +NO_F_PATH_IN_STRUCT_FILE= +OCFS2_CHECK_KERNEL([f_path in fs.h], fs.h, + , NO_F_PATH_IN_STRUCT_FILE=yes, [struct path.*f_path]) +AC_SUBST(NO_F_PATH_IN_STRUCT_FILE) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS fpath.h" + # End kapi_compat checks diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile index efa7f57..86dabb1 100644 --- a/fs/ocfs2/Makefile +++ b/fs/ocfs2/Makefile @@ -44,6 +44,10 @@ ifdef NO_DLMCONSTANTS_HEADER EXTRA_CFLAGS += -DNO_DLMCONSTANTS_HEADER endif +ifdef NO_F_PATH_IN_STRUCT_FILE +EXTRA_CFLAGS += -DNO_F_PATH_IN_STRUCT_FILE +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes. diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c index deb2b13..67a3731 100644 --- a/fs/ocfs2/aops.c +++ b/fs/ocfs2/aops.c @@ -636,7 +636,7 @@ static void ocfs2_dio_end_io(struct kiocb *iocb, ssize_t bytes, void *private) { - struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode; + struct inode *inode = filp_dentry(iocb->ki_filp)->d_inode; int level; /* this io's submitter should not have unlocked this before we could */ @@ -678,7 +678,7 @@ static ssize_t ocfs2_direct_IO(int rw, unsigned long nr_segs) { struct file *file = iocb->ki_filp; - struct inode *inode = file->f_path.dentry->d_inode->i_mapping->host; + struct inode *inode = filp_dentry(file)->d_inode->i_mapping->host; int ret; mlog_entry_void(); diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c index 28c3ec2..69b3402 100644 --- a/fs/ocfs2/dir.c +++ b/fs/ocfs2/dir.c @@ -2025,7 +2025,7 @@ int ocfs2_dir_foreach(struct inode *inode, loff_t *f_pos, void *priv, int ocfs2_readdir(struct file * filp, void * dirent, filldir_t filldir) { int error = 0; - struct inode *inode = filp->f_path.dentry->d_inode; + struct inode *inode = filp_dentry(filp)->d_inode; int lock_level = 0; mlog_entry("dirino=%llu\n", diff --git a/fs/ocfs2/dlm/Makefile b/fs/ocfs2/dlm/Makefile index 44b6cc6..a42d35d 100644 --- a/fs/ocfs2/dlm/Makefile +++ b/fs/ocfs2/dlm/Makefile @@ -26,6 +26,10 @@ ifdef NO_DELAYED_WORK_STRUCT EXTRA_CFLAGS += -DNO_DELAYED_WORK_STRUCT endif +ifdef NO_F_PATH_IN_STRUCT_FILE +EXTRA_CFLAGS += -DNO_F_PATH_IN_STRUCT_FILE +endif + DLM_SOURCES += \ dlmast.c \ dlmconvert.c \ diff --git a/fs/ocfs2/dlm/dlmfs.c b/fs/ocfs2/dlm/dlmfs.c index 02bf178..8e293fa 100644 --- a/fs/ocfs2/dlm/dlmfs.c +++ b/fs/ocfs2/dlm/dlmfs.c @@ -187,7 +187,7 @@ static ssize_t dlmfs_file_read(struct file *filp, int bytes_left; ssize_t readlen; char *lvb_buf; - struct inode *inode = filp->f_path.dentry->d_inode; + struct inode *inode = filp_dentry(filp)->d_inode; mlog(0, "inode %lu, count = %zu, *ppos = %llu\n", inode->i_ino, count, *ppos); @@ -231,7 +231,7 @@ static ssize_t dlmfs_file_write(struct file *filp, int bytes_left; ssize_t writelen; char *lvb_buf; - struct inode *inode = filp->f_path.dentry->d_inode; + struct inode *inode = filp_dentry(filp)->d_inode; mlog(0, "inode %lu, count = %zu, *ppos = %llu\n", inode->i_ino, count, *ppos); diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 89fc8ee..68bf44f 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c @@ -105,7 +105,7 @@ static int ocfs2_file_open(struct inode *inode, struct file *file) struct ocfs2_inode_info *oi = OCFS2_I(inode); mlog_entry("(0x%p, 0x%p, '%.*s')\n", inode, file, - file->f_path.dentry->d_name.len, file->f_path.dentry->d_name.name); + filp_dentry(file)->d_name.len, filp_dentry(file)->d_name.name); spin_lock(&oi->ip_lock); @@ -146,8 +146,8 @@ static int ocfs2_file_release(struct inode *inode, struct file *file) struct ocfs2_inode_info *oi = OCFS2_I(inode); mlog_entry("(0x%p, 0x%p, '%.*s')\n", inode, file, - file->f_path.dentry->d_name.len, - file->f_path.dentry->d_name.name); + filp_dentry(file)->d_name.len, + filp_dentry(file)->d_name.name); spin_lock(&oi->ip_lock); if (!--oi->ip_open_count) @@ -1593,7 +1593,7 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode, } } - if (file && should_remove_suid(file->f_path.dentry)) { + if (file && should_remove_suid(filp_dentry(file))) { ret = __ocfs2_write_remove_suid(inode, di_bh); if (ret) { mlog_errno(ret); @@ -1660,7 +1660,7 @@ out: int ocfs2_change_file_space(struct file *file, unsigned int cmd, struct ocfs2_space_resv *sr) { - struct inode *inode = file->f_path.dentry->d_inode; + struct inode *inode = filp_dentry(file)->d_inode; struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); if ((cmd == OCFS2_IOC_RESVSP || cmd == OCFS2_IOC_RESVSP64) && @@ -1905,13 +1905,13 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb, loff_t old_size, *ppos = &iocb->ki_pos; u32 old_clusters; struct file *file = iocb->ki_filp; - struct inode *inode = file->f_path.dentry->d_inode; + struct inode *inode = filp_dentry(file)->d_inode; struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); mlog_entry("(0x%p, %u, '%.*s')\n", file, (unsigned int)nr_segs, - file->f_path.dentry->d_name.len, - file->f_path.dentry->d_name.name); + filp_dentry(file)->d_name.len, + filp_dentry(file)->d_name.name); if (iocb->ki_left == 0) return 0; @@ -1939,7 +1939,7 @@ relock: } can_do_direct = direct_io; - ret = ocfs2_prepare_inode_for_write(file->f_path.dentry, ppos, + ret = ocfs2_prepare_inode_for_write(filp_dentry(file), ppos, iocb->ki_left, appending, &can_do_direct); if (ret < 0) { @@ -2060,7 +2060,7 @@ static int ocfs2_splice_to_file(struct pipe_inode_info *pipe, { int ret; - ret = ocfs2_prepare_inode_for_write(out->f_path.dentry, &sd->pos, + ret = ocfs2_prepare_inode_for_write(filp_dentry(out), &sd->pos, sd->total_len, 0, NULL); if (ret < 0) { mlog_errno(ret); @@ -2088,8 +2088,8 @@ static ssize_t ocfs2_file_splice_write(struct pipe_inode_info *pipe, mlog_entry("(0x%p, 0x%p, %u, '%.*s')\n", out, pipe, (unsigned int)len, - out->f_path.dentry->d_name.len, - out->f_path.dentry->d_name.name); + filp_dentry(out)->d_name.len, + filp_dentry(out)->d_name.name); if (pipe->inode) mutex_lock_nested(&pipe->inode->i_mutex, I_MUTEX_PARENT); @@ -2144,12 +2144,12 @@ static ssize_t ocfs2_file_splice_read(struct file *in, unsigned int flags) { int ret = 0, lock_level = 0; - struct inode *inode = in->f_path.dentry->d_inode; + struct inode *inode = filp_dentry(in)->d_inode; mlog_entry("(0x%p, 0x%p, %u, '%.*s')\n", in, pipe, (unsigned int)len, - in->f_path.dentry->d_name.len, - in->f_path.dentry->d_name.name); + filp_dentry(in)->d_name.len, + filp_dentry(in)->d_name.name); /* * See the comment in ocfs2_file_aio_read() @@ -2175,12 +2175,12 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb, { int ret = 0, rw_level = -1, have_alloc_sem = 0, lock_level = 0; struct file *filp = iocb->ki_filp; - struct inode *inode = filp->f_path.dentry->d_inode; + struct inode *inode = filp_dentry(filp)->d_inode; mlog_entry("(0x%p, %u, '%.*s')\n", filp, (unsigned int)nr_segs, - filp->f_path.dentry->d_name.len, - filp->f_path.dentry->d_name.name); + filp_dentry(filp)->d_name.len, + filp_dentry(filp)->d_name.name); if (!inode) { ret = -EINVAL; diff --git a/fs/ocfs2/ioctl.c b/fs/ocfs2/ioctl.c index 31fbb06..857b409 100644 --- a/fs/ocfs2/ioctl.c +++ b/fs/ocfs2/ioctl.c @@ -110,7 +110,7 @@ bail: long ocfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { - struct inode *inode = filp->f_path.dentry->d_inode; + struct inode *inode = filp_dentry(filp)->d_inode; unsigned int flags; int new_clusters; int status; @@ -132,12 +132,12 @@ long ocfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) if (get_user(flags, (int __user *) arg)) return -EFAULT; - status = mnt_want_write(filp->f_path.mnt); + status = mnt_want_write(filp_mnt(filp)); if (status) return status; status = ocfs2_set_inode_attr(inode, flags, OCFS2_FL_MODIFIABLE); - mnt_drop_write(filp->f_path.mnt); + mnt_drop_write(filp_mnt(filp)); return status; case OCFS2_IOC_RESVSP: case OCFS2_IOC_RESVSP64: diff --git a/fs/ocfs2/mmap.c b/fs/ocfs2/mmap.c index 3973761..55afd11 100644 --- a/fs/ocfs2/mmap.c +++ b/fs/ocfs2/mmap.c @@ -157,7 +157,7 @@ out: static int ocfs2_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) { struct page *page = vmf->page; - struct inode *inode = vma->vm_file->f_path.dentry->d_inode; + struct inode *inode = filp_dentry(vma->vm_file)->d_inode; struct buffer_head *di_bh = NULL; sigset_t blocked, oldset; int ret, ret2; @@ -211,13 +211,13 @@ int ocfs2_mmap(struct file *file, struct vm_area_struct *vma) { int ret = 0, lock_level = 0; - ret = ocfs2_inode_lock_atime(file->f_dentry->d_inode, - file->f_vfsmnt, &lock_level); + ret = ocfs2_inode_lock_atime(filp_dentry(file)->d_inode, + filp_mnt(file), &lock_level); if (ret < 0) { mlog_errno(ret); goto out; } - ocfs2_inode_unlock(file->f_dentry->d_inode, lock_level); + ocfs2_inode_unlock(filp_dentry(file)->d_inode, lock_level); out: vma->vm_ops = &ocfs2_file_vm_ops; vma->vm_flags |= VM_CAN_NONLINEAR; diff --git a/kapi-compat/include/fpath.h b/kapi-compat/include/fpath.h new file mode 100644 index 0000000..f8b53f2 --- /dev/null +++ b/kapi-compat/include/fpath.h @@ -0,0 +1,12 @@ +#ifndef KAPI_FPATH_H +#define KAPI_FPATH_H + +#ifdef NO_F_PATH_IN_STRUCT_FILE +# define filp_dentry(i) (i)->f_dentry +# define filp_mnt(i) (i)->f_vfsmnt +#else +# define filp_dentry(i) (i)->f_path.dentry +# define filp_mnt(i) (i)->f_path.mnt +#endif + +#endif -- 1.5.6.5 From sunil.mushran at oracle.com Mon Nov 9 18:00:07 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Mon, 9 Nov 2009 18:00:07 -0800 Subject: [Ocfs2-devel] [PATCH 04/10] ocfs2: Enable CONFIG_OCFS2_FS_POSIX_ACL In-Reply-To: <1257818413-32014-1-git-send-email-sunil.mushran@oracle.com> References: <1257818413-32014-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1257818413-32014-5-git-send-email-sunil.mushran@oracle.com> Signed-off-by: Sunil Mushran --- fs/ocfs2/Makefile | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile index e997fe4..efa7f57 100644 --- a/fs/ocfs2/Makefile +++ b/fs/ocfs2/Makefile @@ -34,6 +34,8 @@ EXTRA_CFLAGS += -DCONFIG_OCFS2_DEBUG_MASKLOG EXTRA_CFLAGS += -DCONFIG_OCFS2_FS_STATS +EXTRA_CFLAGS += -DCONFIG_OCFS2_FS_POSIX_ACL + ifdef NO_DELAYED_WORK_STRUCT EXTRA_CFLAGS += -DNO_DELAYED_WORK_STRUCT endif -- 1.5.6.5 From sunil.mushran at oracle.com Mon Nov 9 18:00:12 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Mon, 9 Nov 2009 18:00:12 -0800 Subject: [Ocfs2-devel] [PATCH 09/10] ocfs2: Handle missing USHORT_MAX In-Reply-To: <1257818413-32014-1-git-send-email-sunil.mushran@oracle.com> References: <1257818413-32014-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1257818413-32014-10-git-send-email-sunil.mushran@oracle.com> Mainline commit 44f564a4bf6ac70f2a84806203045cf515bc9367 USHORT_MAX. Signed-off-by: Sunil Mushran --- Makefile | 3 ++- configure.in | 5 +++++ kapi-compat/include/ushortmax.h | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/ushortmax.h diff --git a/Makefile b/Makefile index 6a28531..6e28427 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/task_pid_nr.h \ kapi-compat/include/current_umask.h \ kapi-compat/include/sync_mapping.h \ - kapi-compat/include/fpath.h + kapi-compat/include/fpath.h \ + kapi-compat/include/ushortmax.h PATCH_FILES = diff --git a/configure.in b/configure.in index 8179f59..4d9bea3 100644 --- a/configure.in +++ b/configure.in @@ -212,6 +212,11 @@ if test "x$ADDRESS_SPACE_OPS_EXT" = "x" ; then fi fi +ushort_max_compat_header= +OCFS2_CHECK_KERNEL([USHORT_MAX in kernel.h], kernel.h, + , ushort_max_compat_header="ushortmax.h", [#define USHORT_MAX]) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $ushort_max_compat_header" + # End kapi_compat checks diff --git a/kapi-compat/include/ushortmax.h b/kapi-compat/include/ushortmax.h new file mode 100644 index 0000000..a12633a --- /dev/null +++ b/kapi-compat/include/ushortmax.h @@ -0,0 +1,6 @@ +#ifndef KAPI_USHORTMAX_H +#define KAPI_USHORTMAX_H + +#define USHORT_MAX ((u16)(~0U)) + +#endif -- 1.5.6.5 From sunil.mushran at oracle.com Mon Nov 9 18:00:08 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Mon, 9 Nov 2009 18:00:08 -0800 Subject: [Ocfs2-devel] [PATCH 05/10] ocfs2: Add helper current_umask() In-Reply-To: <1257818413-32014-1-git-send-email-sunil.mushran@oracle.com> References: <1257818413-32014-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1257818413-32014-6-git-send-email-sunil.mushran@oracle.com> Mainline commit ce3b0f8d5c2203301fc87f3aaaed73e5819e2a48 adde helper current_umask(). Signed-off-by: Sunil Mushran --- Makefile | 3 ++- configure.in | 5 +++++ kapi-compat/include/current_umask.h | 9 +++++++++ 3 files changed, 16 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/current_umask.h diff --git a/Makefile b/Makefile index 98726c9..950d6fc 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,8 @@ LINUX_INCLUDE_FILES = KAPI_COMPAT_FILES = \ kapi-compat/include/workqueue.h \ kapi-compat/include/dlmconstants.h \ - kapi-compat/include/task_pid_nr.h + kapi-compat/include/task_pid_nr.h \ + kapi-compat/include/current_umask.h PATCH_FILES = diff --git a/configure.in b/configure.in index e94412b..93f9632 100644 --- a/configure.in +++ b/configure.in @@ -175,6 +175,11 @@ OCFS2_CHECK_KERNEL([task_pid_nr() in sched.h], sched.h, , task_pid_nr_compat_header="task_pid_nr.h", [^static inline pid_t task_pid_nr(struct]) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $task_pid_nr_compat_header" +current_umask_compat_header= +OCFS2_CHECK_KERNEL([current_umask() in fs.h], fs.h, + , current_umask_compat_header="current_umask.h", [^extern int current_umask(void)]) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $current_umask_compat_header" + # End kapi_compat checks diff --git a/kapi-compat/include/current_umask.h b/kapi-compat/include/current_umask.h new file mode 100644 index 0000000..eee781f --- /dev/null +++ b/kapi-compat/include/current_umask.h @@ -0,0 +1,9 @@ +#ifndef KAPI_CURRENT_UMASK_H +#define KAPI_CURRENT_UMASK_H + +static inline int current_umask(void) +{ + return current->fs->umask; +} + +#endif -- 1.5.6.5 From Joel.Becker at oracle.com Tue Nov 10 16:38:07 2009 From: Joel.Becker at oracle.com (Joel Becker) Date: Tue, 10 Nov 2009 16:38:07 -0800 Subject: [Ocfs2-devel] Initial patches for ocfs2 1.6 In-Reply-To: <1257811737-10835-1-git-send-email-sunil.mushran@oracle.com> References: <1257811737-10835-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <20091111003806.GA17774@mail.oracle.com> On Mon, Nov 09, 2009 at 04:08:53PM -0800, Sunil Mushran wrote: > So the ocfs2 1.6 repository is up. It is a copy of the fs in the mainline. > I have some 70-80 patches that will make it run atop el5 u4. The patches > will be posted in smaller batches so as to make it easier to review. > > The first set handles the makefiles, etc. Ack. -- "Not being known doesn't stop the truth from being true." - Richard Bach Joel Becker Principal Software Developer Oracle E-mail: joel.becker at oracle.com Phone: (650) 506-8127 From sunil.mushran at oracle.com Tue Nov 10 17:38:26 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Tue, 10 Nov 2009 17:38:26 -0800 Subject: [Ocfs2-devel] [PATCH 4/8] ocfs2: Handle non-const sb->s_op In-Reply-To: <1257903510-29198-1-git-send-email-sunil.mushran@oracle.com> References: <1257903510-29198-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1257903510-29198-5-git-send-email-sunil.mushran@oracle.com> Mainline commit ee9b6d61a2a43c5952eb43283f8db284a4e70b8a const-ified sb->s_op. Signed-off-by: Sunil Mushran --- Config.make.in | 1 + configure.in | 5 +++++ fs/ocfs2/Makefile | 4 ++++ fs/ocfs2/dlm/Makefile | 4 ++++ fs/ocfs2/dlm/dlmfs.c | 8 ++++++++ fs/ocfs2/super.c | 4 ++++ 6 files changed, 26 insertions(+), 0 deletions(-) diff --git a/Config.make.in b/Config.make.in index 7cda5cb..9da1d2b 100644 --- a/Config.make.in +++ b/Config.make.in @@ -65,6 +65,7 @@ FVERSION_IS_ULONG = @FVERSION_IS_ULONG@ SEQ_OPS_IS_NOT_CONST = @SEQ_OPS_IS_NOT_CONST@ IOP_IS_NOT_CONST = @IOP_IS_NOT_CONST@ DOP_IS_NOT_CONST = @DOP_IS_NOT_CONST@ +SOP_IS_NOT_CONST = @SOP_IS_NOT_CONST@ OCFS_DEBUG = @OCFS_DEBUG@ diff --git a/configure.in b/configure.in index f79da91..76ea242 100644 --- a/configure.in +++ b/configure.in @@ -247,6 +247,11 @@ OCFS2_CHECK_KERNEL([dentry->d_op has the const modifier in dcache.h], dcache.h, , DOP_IS_NOT_CONST=yes, [^.*const struct dentry_operations \*d_op;]) AC_SUBST(DOP_IS_NOT_CONST) +SOP_IS_NOT_CONST= +OCFS2_CHECK_KERNEL([sb->s_op has the const modifier in fs.h], fs.h, + , SOP_IS_NOT_CONST=yes, [^.*const struct super_operations.*\*s_op;]) +AC_SUBST(SOP_IS_NOT_CONST) + # End kapi_compat checks diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile index 4e1a0e6..ddeb107 100644 --- a/fs/ocfs2/Makefile +++ b/fs/ocfs2/Makefile @@ -68,6 +68,10 @@ ifdef DOP_IS_NOT_CONST EXTRA_CFLAGS += -DDOP_IS_NOT_CONST endif +ifdef SOP_IS_NOT_CONST +EXTRA_CFLAGS += -DSOP_IS_NOT_CONST +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes. diff --git a/fs/ocfs2/dlm/Makefile b/fs/ocfs2/dlm/Makefile index 250994f..b70058d 100644 --- a/fs/ocfs2/dlm/Makefile +++ b/fs/ocfs2/dlm/Makefile @@ -34,6 +34,10 @@ ifdef IOP_IS_NOT_CONST EXTRA_CFLAGS += -DIOP_IS_NOT_CONST endif +ifdef SOP_IS_NOT_CONST +EXTRA_CFLAGS += -DSOP_IS_NOT_CONST +endif + DLM_SOURCES += \ dlmast.c \ dlmconvert.c \ diff --git a/fs/ocfs2/dlm/dlmfs.c b/fs/ocfs2/dlm/dlmfs.c index b1b9996..d05653d 100644 --- a/fs/ocfs2/dlm/dlmfs.c +++ b/fs/ocfs2/dlm/dlmfs.c @@ -62,7 +62,11 @@ #include "ocfs2_lockingver.h" +#ifdef SOP_IS_NOT_CONST +static struct super_operations dlmfs_ops; +#else static const struct super_operations dlmfs_ops; +#endif static const struct file_operations dlmfs_file_operations; #ifdef IOP_IS_NOT_CONST static struct inode_operations dlmfs_dir_inode_operations; @@ -580,7 +584,11 @@ static const struct inode_operations dlmfs_root_inode_operations = { .rmdir = simple_rmdir, }; +#ifdef SOP_IS_NOT_CONST +static struct super_operations dlmfs_ops = { +#else static const struct super_operations dlmfs_ops = { +#endif .statfs = simple_statfs, .alloc_inode = dlmfs_alloc_inode, .destroy_inode = dlmfs_destroy_inode, diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 8c8b206..5e4fbad 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c @@ -135,7 +135,11 @@ static int ocfs2_susp_quotas(struct ocfs2_super *osb, int unsuspend); static int ocfs2_enable_quotas(struct ocfs2_super *osb); static void ocfs2_disable_quotas(struct ocfs2_super *osb); +#ifdef SOP_IS_NOT_CONST +static struct super_operations ocfs2_sops = { +#else static const struct super_operations ocfs2_sops = { +#endif .statfs = ocfs2_statfs, .alloc_inode = ocfs2_alloc_inode, .destroy_inode = ocfs2_destroy_inode, -- 1.5.6.5 From sunil.mushran at oracle.com Tue Nov 10 17:38:25 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Tue, 10 Nov 2009 17:38:25 -0800 Subject: [Ocfs2-devel] [PATCH 3/8] ocfs2: Handle non-const dentry->d_op In-Reply-To: <1257903510-29198-1-git-send-email-sunil.mushran@oracle.com> References: <1257903510-29198-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1257903510-29198-4-git-send-email-sunil.mushran@oracle.com> Mainline commit e56980d451904b623573ef4966cbab768e433c79 const-ified dentry->d_op. Signed-off-by: Sunil Mushran --- Config.make.in | 1 + configure.in | 6 ++++++ fs/ocfs2/Makefile | 4 ++++ fs/ocfs2/dcache.c | 4 ++++ fs/ocfs2/dcache.h | 4 ++++ 5 files changed, 19 insertions(+), 0 deletions(-) diff --git a/Config.make.in b/Config.make.in index 2c18b6f..7cda5cb 100644 --- a/Config.make.in +++ b/Config.make.in @@ -64,6 +64,7 @@ ADDRESS_SPACE_OPS_EXT = @ADDRESS_SPACE_OPS_EXT@ FVERSION_IS_ULONG = @FVERSION_IS_ULONG@ SEQ_OPS_IS_NOT_CONST = @SEQ_OPS_IS_NOT_CONST@ IOP_IS_NOT_CONST = @IOP_IS_NOT_CONST@ +DOP_IS_NOT_CONST = @DOP_IS_NOT_CONST@ OCFS_DEBUG = @OCFS_DEBUG@ diff --git a/configure.in b/configure.in index 16d02c3..f79da91 100644 --- a/configure.in +++ b/configure.in @@ -242,6 +242,12 @@ OCFS2_CHECK_KERNEL([inode->i_op has the const modifier in fs.h], fs.h, AC_SUBST(IOP_IS_NOT_CONST) +DOP_IS_NOT_CONST= +OCFS2_CHECK_KERNEL([dentry->d_op has the const modifier in dcache.h], dcache.h, + , DOP_IS_NOT_CONST=yes, [^.*const struct dentry_operations \*d_op;]) +AC_SUBST(DOP_IS_NOT_CONST) + + # End kapi_compat checks # using -include has two advantages: diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile index e66665a..4e1a0e6 100644 --- a/fs/ocfs2/Makefile +++ b/fs/ocfs2/Makefile @@ -64,6 +64,10 @@ ifdef IOP_IS_NOT_CONST EXTRA_CFLAGS += -DIOP_IS_NOT_CONST endif +ifdef DOP_IS_NOT_CONST +EXTRA_CFLAGS += -DDOP_IS_NOT_CONST +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes. diff --git a/fs/ocfs2/dcache.c b/fs/ocfs2/dcache.c index 8ad82bc..55a3fdb 100644 --- a/fs/ocfs2/dcache.c +++ b/fs/ocfs2/dcache.c @@ -500,7 +500,11 @@ out_move: d_move(dentry, target); } +#ifdef DOP_IS_NOT_CONST +struct dentry_operations ocfs2_dentry_ops = { +#else const struct dentry_operations ocfs2_dentry_ops = { +#endif .d_revalidate = ocfs2_dentry_revalidate, .d_iput = ocfs2_dentry_iput, }; diff --git a/fs/ocfs2/dcache.h b/fs/ocfs2/dcache.h index d13a087..2703a1a 100644 --- a/fs/ocfs2/dcache.h +++ b/fs/ocfs2/dcache.h @@ -26,7 +26,11 @@ #ifndef OCFS2_DCACHE_H #define OCFS2_DCACHE_H +#ifdef DOP_IS_NOT_CONST +extern struct dentry_operations ocfs2_dentry_ops; +#else extern const struct dentry_operations ocfs2_dentry_ops; +#endif struct ocfs2_dentry_lock { /* Use count of dentry lock */ -- 1.5.6.5 From sunil.mushran at oracle.com Tue Nov 10 17:38:23 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Tue, 10 Nov 2009 17:38:23 -0800 Subject: [Ocfs2-devel] [PATCH 1/8] ocfs2: Handle non-const seq_operations In-Reply-To: <1257903510-29198-1-git-send-email-sunil.mushran@oracle.com> References: <1257903510-29198-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1257903510-29198-2-git-send-email-sunil.mushran@oracle.com> Mainline commit 15ad7cdcfd76450d4beebc789ec646664238184d const-ified seq_file->op. Signed-off-by: Sunil Mushran --- Config.make.in | 1 + configure.in | 5 +++++ fs/ocfs2/Makefile | 4 ++++ fs/ocfs2/dlmglue.c | 4 ++++ 4 files changed, 14 insertions(+), 0 deletions(-) diff --git a/Config.make.in b/Config.make.in index ba72950..18edfa8 100644 --- a/Config.make.in +++ b/Config.make.in @@ -62,6 +62,7 @@ NO_DLMCONSTANTS_HEADER = @NO_DLMCONSTANTS_HEADER@ NO_F_PATH_IN_STRUCT_FILE = @NO_F_PATH_IN_STRUCT_FILE@ ADDRESS_SPACE_OPS_EXT = @ADDRESS_SPACE_OPS_EXT@ FVERSION_IS_ULONG = @FVERSION_IS_ULONG@ +SEQ_OPS_IS_NOT_CONST = @SEQ_OPS_IS_NOT_CONST@ OCFS_DEBUG = @OCFS_DEBUG@ diff --git a/configure.in b/configure.in index 7ee2d34..b1aaf4e 100644 --- a/configure.in +++ b/configure.in @@ -231,6 +231,11 @@ if test "x$FVERSION_IS_ULONG" = "x" ; then fi KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS fversion.h" +SEQ_OPS_IS_NOT_CONST= +OCFS2_CHECK_KERNEL([const struct seq_operations in seq_file.h], seq_file.h, + , SEQ_OPS_IS_NOT_CONST=yes, [const struct seq_operations \*op;]) +AC_SUBST(SEQ_OPS_IS_NOT_CONST) + # End kapi_compat checks diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile index e6b5801..37d3009 100644 --- a/fs/ocfs2/Makefile +++ b/fs/ocfs2/Makefile @@ -56,6 +56,10 @@ ifdef FVERSION_IS_ULONG EXTRA_CFLAGS += -DFVERSION_IS_ULONG endif +ifdef SEQ_OPS_IS_NOT_CONST +EXTRA_CFLAGS += -DSEQ_OPS_IS_NOT_CONST +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes. diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c index 0d38d67..0b73382 100644 --- a/fs/ocfs2/dlmglue.c +++ b/fs/ocfs2/dlmglue.c @@ -2834,7 +2834,11 @@ static int ocfs2_dlm_seq_show(struct seq_file *m, void *v) return 0; } +#ifndef SEQ_OPS_IS_NOT_CONST static const struct seq_operations ocfs2_dlm_seq_ops = { +#else +static struct seq_operations ocfs2_dlm_seq_ops = { +#endif .start = ocfs2_dlm_seq_start, .stop = ocfs2_dlm_seq_stop, .next = ocfs2_dlm_seq_next, -- 1.5.6.5 From sunil.mushran at oracle.com Tue Nov 10 17:38:29 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Tue, 10 Nov 2009 17:38:29 -0800 Subject: [Ocfs2-devel] [PATCH 7/8] ocfs2: Handle non-const vm_area_struct->vm_ops In-Reply-To: <1257903510-29198-1-git-send-email-sunil.mushran@oracle.com> References: <1257903510-29198-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1257903510-29198-8-git-send-email-sunil.mushran@oracle.com> Mainline commit f0f37e2f77731b3473fa6bd5ee53255d9a9cdb40 const-ified vm_area_struct->vm_ops. Signed-off-by: Sunil Mushran --- Config.make.in | 1 + configure.in | 5 +++++ fs/ocfs2/Makefile | 4 ++++ fs/ocfs2/mmap.c | 4 ++++ 4 files changed, 14 insertions(+), 0 deletions(-) diff --git a/Config.make.in b/Config.make.in index 8e1f49a..32d99a8 100644 --- a/Config.make.in +++ b/Config.make.in @@ -68,6 +68,7 @@ DOP_IS_NOT_CONST = @DOP_IS_NOT_CONST@ SOP_IS_NOT_CONST = @SOP_IS_NOT_CONST@ EXPORTOP_IS_NOT_CONST = @EXPORTOP_IS_NOT_CONST@ MATCHTABLE_IS_NOT_CONST = @MATCHTABLE_IS_NOT_CONST@ +VMOP_IS_NOT_CONST = @VMOP_IS_NOT_CONST@ OCFS_DEBUG = @OCFS_DEBUG@ diff --git a/configure.in b/configure.in index b0dabdd..e7939c4 100644 --- a/configure.in +++ b/configure.in @@ -262,6 +262,11 @@ OCFS2_CHECK_KERNEL([match_token() takes const arg in parser.h], parser.h, , MATCHTABLE_IS_NOT_CONST=yes, [^int match_token(char \*, const match_table_t table, ]) AC_SUBST(MATCHTABLE_IS_NOT_CONST) +VMOP_IS_NOT_CONST= +OCFS2_CHECK_KERNEL([vm_area_struct->vm_ops has the const modifier in mm.h], mm.h, + , VMOP_IS_NOT_CONST=yes, [^.*const struct vm_operations_struct \*vm_ops;]) +AC_SUBST(VMOP_IS_NOT_CONST) + # End kapi_compat checks diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile index bd5afb5..b8ce33c 100644 --- a/fs/ocfs2/Makefile +++ b/fs/ocfs2/Makefile @@ -80,6 +80,10 @@ ifdef MATCHTABLE_IS_NOT_CONST EXTRA_CFLAGS += -DMATCHTABLE_IS_NOT_CONST endif +ifdef VMOP_IS_NOT_CONST +EXTRA_CFLAGS += -DVMOP_IS_NOT_CONST +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes. diff --git a/fs/ocfs2/mmap.c b/fs/ocfs2/mmap.c index 55afd11..b4a25c8 100644 --- a/fs/ocfs2/mmap.c +++ b/fs/ocfs2/mmap.c @@ -202,7 +202,11 @@ out: return ret; } +#ifdef VMOP_IS_NOT_CONST +static struct vm_operations_struct ocfs2_file_vm_ops = { +#else static const struct vm_operations_struct ocfs2_file_vm_ops = { +#endif .fault = ocfs2_fault, .page_mkwrite = ocfs2_page_mkwrite, }; -- 1.5.6.5 From sunil.mushran at oracle.com Tue Nov 10 17:38:28 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Tue, 10 Nov 2009 17:38:28 -0800 Subject: [Ocfs2-devel] [PATCH 6/8] ocfs2: Handle missing const modifier in match_token() args In-Reply-To: <1257903510-29198-1-git-send-email-sunil.mushran@oracle.com> References: <1257903510-29198-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1257903510-29198-7-git-send-email-sunil.mushran@oracle.com> Mainline commit a447c0932445f92ce6f4c1bd020f62c5097a7842 const-ified match_table_t argument in match_token(). Signed-off-by: Sunil Mushran --- Config.make.in | 1 + configure.in | 5 +++++ fs/ocfs2/Makefile | 4 ++++ fs/ocfs2/super.c | 4 ++++ 4 files changed, 14 insertions(+), 0 deletions(-) diff --git a/Config.make.in b/Config.make.in index 9d2feb2..8e1f49a 100644 --- a/Config.make.in +++ b/Config.make.in @@ -67,6 +67,7 @@ IOP_IS_NOT_CONST = @IOP_IS_NOT_CONST@ DOP_IS_NOT_CONST = @DOP_IS_NOT_CONST@ SOP_IS_NOT_CONST = @SOP_IS_NOT_CONST@ EXPORTOP_IS_NOT_CONST = @EXPORTOP_IS_NOT_CONST@ +MATCHTABLE_IS_NOT_CONST = @MATCHTABLE_IS_NOT_CONST@ OCFS_DEBUG = @OCFS_DEBUG@ diff --git a/configure.in b/configure.in index 2ab0696..b0dabdd 100644 --- a/configure.in +++ b/configure.in @@ -257,6 +257,11 @@ OCFS2_CHECK_KERNEL([sb->s_export_op has the const modifier in fs.h], fs.h, , EXPORTOP_IS_NOT_CONST=yes, [^.*const struct export_operations \*s_export_op;]) AC_SUBST(EXPORTOP_IS_NOT_CONST) +MATCHTABLE_IS_NOT_CONST= +OCFS2_CHECK_KERNEL([match_token() takes const arg in parser.h], parser.h, + , MATCHTABLE_IS_NOT_CONST=yes, [^int match_token(char \*, const match_table_t table, ]) +AC_SUBST(MATCHTABLE_IS_NOT_CONST) + # End kapi_compat checks diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile index f39b1ee..bd5afb5 100644 --- a/fs/ocfs2/Makefile +++ b/fs/ocfs2/Makefile @@ -76,6 +76,10 @@ ifdef EXPORTOP_IS_NOT_CONST EXTRA_CFLAGS += -DEXPORTOP_IS_NOT_CONST endif +ifdef MATCHTABLE_IS_NOT_CONST +EXTRA_CFLAGS += -DMATCHTABLE_IS_NOT_CONST +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes. diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 5e4fbad..bee2c31 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c @@ -180,7 +180,11 @@ enum { Opt_err, }; +#ifdef MATCHTABLE_IS_NOT_CONST +static match_table_t tokens = { +#else static const match_table_t tokens = { +#endif {Opt_barrier, "barrier=%u"}, {Opt_err_panic, "errors=panic"}, {Opt_err_ro, "errors=remount-ro"}, -- 1.5.6.5 From sunil.mushran at oracle.com Tue Nov 10 17:38:27 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Tue, 10 Nov 2009 17:38:27 -0800 Subject: [Ocfs2-devel] [PATCH 5/8] ocfs2: Handle non-const sb->s_export_op In-Reply-To: <1257903510-29198-1-git-send-email-sunil.mushran@oracle.com> References: <1257903510-29198-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1257903510-29198-6-git-send-email-sunil.mushran@oracle.com> Mainline commit 39655164405940d4818224a085e35420e2f97aed const-ified sb->s_export_op. Signed-off-by: Sunil Mushran --- Config.make.in | 1 + configure.in | 5 +++++ fs/ocfs2/Makefile | 4 ++++ fs/ocfs2/export.c | 4 ++++ fs/ocfs2/export.h | 4 ++++ 5 files changed, 18 insertions(+), 0 deletions(-) diff --git a/Config.make.in b/Config.make.in index 9da1d2b..9d2feb2 100644 --- a/Config.make.in +++ b/Config.make.in @@ -66,6 +66,7 @@ SEQ_OPS_IS_NOT_CONST = @SEQ_OPS_IS_NOT_CONST@ IOP_IS_NOT_CONST = @IOP_IS_NOT_CONST@ DOP_IS_NOT_CONST = @DOP_IS_NOT_CONST@ SOP_IS_NOT_CONST = @SOP_IS_NOT_CONST@ +EXPORTOP_IS_NOT_CONST = @EXPORTOP_IS_NOT_CONST@ OCFS_DEBUG = @OCFS_DEBUG@ diff --git a/configure.in b/configure.in index 76ea242..2ab0696 100644 --- a/configure.in +++ b/configure.in @@ -252,6 +252,11 @@ OCFS2_CHECK_KERNEL([sb->s_op has the const modifier in fs.h], fs.h, , SOP_IS_NOT_CONST=yes, [^.*const struct super_operations.*\*s_op;]) AC_SUBST(SOP_IS_NOT_CONST) +EXPORTOP_IS_NOT_CONST= +OCFS2_CHECK_KERNEL([sb->s_export_op has the const modifier in fs.h], fs.h, + , EXPORTOP_IS_NOT_CONST=yes, [^.*const struct export_operations \*s_export_op;]) +AC_SUBST(EXPORTOP_IS_NOT_CONST) + # End kapi_compat checks diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile index ddeb107..f39b1ee 100644 --- a/fs/ocfs2/Makefile +++ b/fs/ocfs2/Makefile @@ -72,6 +72,10 @@ ifdef SOP_IS_NOT_CONST EXTRA_CFLAGS += -DSOP_IS_NOT_CONST endif +ifdef EXPORTOP_IS_NOT_CONST +EXTRA_CFLAGS += -DEXPORTOP_IS_NOT_CONST +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes. diff --git a/fs/ocfs2/export.c b/fs/ocfs2/export.c index 15713cb..fce7d23 100644 --- a/fs/ocfs2/export.c +++ b/fs/ocfs2/export.c @@ -275,7 +275,11 @@ static struct dentry *ocfs2_fh_to_parent(struct super_block *sb, return ocfs2_get_dentry(sb, &parent); } +#ifdef EXPORTOP_IS_NOT_CONST +struct export_operations ocfs2_export_ops = { +#else const struct export_operations ocfs2_export_ops = { +#endif .encode_fh = ocfs2_encode_fh, .fh_to_dentry = ocfs2_fh_to_dentry, .fh_to_parent = ocfs2_fh_to_parent, diff --git a/fs/ocfs2/export.h b/fs/ocfs2/export.h index 41a7386..0707bf3 100644 --- a/fs/ocfs2/export.h +++ b/fs/ocfs2/export.h @@ -28,6 +28,10 @@ #include +#ifdef EXPORTOP_IS_NOT_CONST +extern struct export_operations ocfs2_export_ops; +#else extern const struct export_operations ocfs2_export_ops; +#endif #endif /* OCFS2_EXPORT_H */ -- 1.5.6.5 From sunil.mushran at oracle.com Tue Nov 10 17:38:24 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Tue, 10 Nov 2009 17:38:24 -0800 Subject: [Ocfs2-devel] [PATCH 2/8] ocfs2: Handle non-const inode->i_op In-Reply-To: <1257903510-29198-1-git-send-email-sunil.mushran@oracle.com> References: <1257903510-29198-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1257903510-29198-3-git-send-email-sunil.mushran@oracle.com> Mainline commit c5ef1c42c51b1b5b4a401a6517bdda30933ddbaf const-ified inode->i_op. Signed-off-by: Sunil Mushran --- Config.make.in | 1 + configure.in | 5 +++++ fs/ocfs2/Makefile | 4 ++++ fs/ocfs2/dlm/Makefile | 4 ++++ fs/ocfs2/dlm/dlmfs.c | 18 ++++++++++++++++++ fs/ocfs2/file.c | 8 ++++++++ fs/ocfs2/file.h | 5 +++++ fs/ocfs2/namei.c | 4 ++++ fs/ocfs2/namei.h | 4 ++++ fs/ocfs2/symlink.c | 9 +++++++++ fs/ocfs2/symlink.h | 5 +++++ 11 files changed, 67 insertions(+), 0 deletions(-) diff --git a/Config.make.in b/Config.make.in index 18edfa8..2c18b6f 100644 --- a/Config.make.in +++ b/Config.make.in @@ -63,6 +63,7 @@ NO_F_PATH_IN_STRUCT_FILE = @NO_F_PATH_IN_STRUCT_FILE@ ADDRESS_SPACE_OPS_EXT = @ADDRESS_SPACE_OPS_EXT@ FVERSION_IS_ULONG = @FVERSION_IS_ULONG@ SEQ_OPS_IS_NOT_CONST = @SEQ_OPS_IS_NOT_CONST@ +IOP_IS_NOT_CONST = @IOP_IS_NOT_CONST@ OCFS_DEBUG = @OCFS_DEBUG@ diff --git a/configure.in b/configure.in index b1aaf4e..16d02c3 100644 --- a/configure.in +++ b/configure.in @@ -236,6 +236,11 @@ OCFS2_CHECK_KERNEL([const struct seq_operations in seq_file.h], seq_file.h, , SEQ_OPS_IS_NOT_CONST=yes, [const struct seq_operations \*op;]) AC_SUBST(SEQ_OPS_IS_NOT_CONST) +IOP_IS_NOT_CONST= +OCFS2_CHECK_KERNEL([inode->i_op has the const modifier in fs.h], fs.h, + , IOP_IS_NOT_CONST=yes, [^.*const struct inode_operations.*\*i_op;]) +AC_SUBST(IOP_IS_NOT_CONST) + # End kapi_compat checks diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile index 37d3009..e66665a 100644 --- a/fs/ocfs2/Makefile +++ b/fs/ocfs2/Makefile @@ -60,6 +60,10 @@ ifdef SEQ_OPS_IS_NOT_CONST EXTRA_CFLAGS += -DSEQ_OPS_IS_NOT_CONST endif +ifdef IOP_IS_NOT_CONST +EXTRA_CFLAGS += -DIOP_IS_NOT_CONST +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes. diff --git a/fs/ocfs2/dlm/Makefile b/fs/ocfs2/dlm/Makefile index a42d35d..250994f 100644 --- a/fs/ocfs2/dlm/Makefile +++ b/fs/ocfs2/dlm/Makefile @@ -30,6 +30,10 @@ ifdef NO_F_PATH_IN_STRUCT_FILE EXTRA_CFLAGS += -DNO_F_PATH_IN_STRUCT_FILE endif +ifdef IOP_IS_NOT_CONST +EXTRA_CFLAGS += -DIOP_IS_NOT_CONST +endif + DLM_SOURCES += \ dlmast.c \ dlmconvert.c \ diff --git a/fs/ocfs2/dlm/dlmfs.c b/fs/ocfs2/dlm/dlmfs.c index 8e293fa..b1b9996 100644 --- a/fs/ocfs2/dlm/dlmfs.c +++ b/fs/ocfs2/dlm/dlmfs.c @@ -64,9 +64,15 @@ static const struct super_operations dlmfs_ops; static const struct file_operations dlmfs_file_operations; +#ifdef IOP_IS_NOT_CONST +static struct inode_operations dlmfs_dir_inode_operations; +static struct inode_operations dlmfs_root_inode_operations; +static struct inode_operations dlmfs_file_inode_operations; +#else static const struct inode_operations dlmfs_dir_inode_operations; static const struct inode_operations dlmfs_root_inode_operations; static const struct inode_operations dlmfs_file_inode_operations; +#endif static struct kmem_cache *dlmfs_inode_cache; struct workqueue_struct *user_dlm_worker; @@ -553,14 +559,22 @@ static const struct file_operations dlmfs_file_operations = { .write = dlmfs_file_write, }; +#ifdef IOP_IS_NOT_CONST +static struct inode_operations dlmfs_dir_inode_operations = { +#else static const struct inode_operations dlmfs_dir_inode_operations = { +#endif .create = dlmfs_create, .lookup = simple_lookup, .unlink = dlmfs_unlink, }; /* this way we can restrict mkdir to only the toplevel of the fs. */ +#ifdef IOP_IS_NOT_CONST +static struct inode_operations dlmfs_root_inode_operations = { +#else static const struct inode_operations dlmfs_root_inode_operations = { +#endif .lookup = simple_lookup, .mkdir = dlmfs_mkdir, .rmdir = simple_rmdir, @@ -574,7 +588,11 @@ static const struct super_operations dlmfs_ops = { .drop_inode = generic_delete_inode, }; +#ifdef IOP_IS_NOT_CONST +static struct inode_operations dlmfs_file_inode_operations = { +#else static const struct inode_operations dlmfs_file_inode_operations = { +#endif .getattr = simple_getattr, }; diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 68bf44f..7bac90d 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c @@ -2245,7 +2245,11 @@ bail: return ret; } +#ifdef IOP_IS_NOT_CONST +struct inode_operations ocfs2_file_iops = { +#else const struct inode_operations ocfs2_file_iops = { +#endif .setattr = ocfs2_setattr, .getattr = ocfs2_getattr, .permission = ocfs2_permission, @@ -2257,7 +2261,11 @@ const struct inode_operations ocfs2_file_iops = { .fiemap = ocfs2_fiemap, }; +#ifdef IOP_IS_NOT_CONST +struct inode_operations ocfs2_special_file_iops = { +#else const struct inode_operations ocfs2_special_file_iops = { +#endif .setattr = ocfs2_setattr, .getattr = ocfs2_getattr, .permission = ocfs2_permission, diff --git a/fs/ocfs2/file.h b/fs/ocfs2/file.h index d66cf4f..da85393 100644 --- a/fs/ocfs2/file.h +++ b/fs/ocfs2/file.h @@ -30,8 +30,13 @@ extern const struct file_operations ocfs2_fops; extern const struct file_operations ocfs2_dops; extern const struct file_operations ocfs2_fops_no_plocks; extern const struct file_operations ocfs2_dops_no_plocks; +#ifdef IOP_IS_NOT_CONST +extern struct inode_operations ocfs2_file_iops; +extern struct inode_operations ocfs2_special_file_iops; +#else extern const struct inode_operations ocfs2_file_iops; extern const struct inode_operations ocfs2_special_file_iops; +#endif struct ocfs2_alloc_context; enum ocfs2_alloc_restarted; diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c index f010b22..f2df1eb 100644 --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c @@ -2309,7 +2309,11 @@ leave: return status; } +#ifdef IOP_IS_NOT_CONST +struct inode_operations ocfs2_dir_iops = { +#else const struct inode_operations ocfs2_dir_iops = { +#endif .create = ocfs2_create, .lookup = ocfs2_lookup, .link = ocfs2_link, diff --git a/fs/ocfs2/namei.h b/fs/ocfs2/namei.h index e5d059d..bc3792e 100644 --- a/fs/ocfs2/namei.h +++ b/fs/ocfs2/namei.h @@ -26,7 +26,11 @@ #ifndef OCFS2_NAMEI_H #define OCFS2_NAMEI_H +#ifdef IOP_IS_NOT_CONST +extern struct inode_operations ocfs2_dir_iops; +#else extern const struct inode_operations ocfs2_dir_iops; +#endif struct dentry *ocfs2_get_parent(struct dentry *child); diff --git a/fs/ocfs2/symlink.c b/fs/ocfs2/symlink.c index e342103..426584f 100644 --- a/fs/ocfs2/symlink.c +++ b/fs/ocfs2/symlink.c @@ -153,7 +153,11 @@ static void ocfs2_fast_put_link(struct dentry *dentry, struct nameidata *nd, voi kfree(link); } +#ifdef IOP_IS_NOT_CONST +struct inode_operations ocfs2_symlink_inode_operations = { +#else const struct inode_operations ocfs2_symlink_inode_operations = { +#endif .readlink = page_readlink, .follow_link = page_follow_link_light, .put_link = page_put_link, @@ -164,7 +168,12 @@ const struct inode_operations ocfs2_symlink_inode_operations = { .listxattr = ocfs2_listxattr, .removexattr = generic_removexattr, }; + +#ifdef IOP_IS_NOT_CONST +struct inode_operations ocfs2_fast_symlink_inode_operations = { +#else const struct inode_operations ocfs2_fast_symlink_inode_operations = { +#endif .readlink = ocfs2_readlink, .follow_link = ocfs2_fast_follow_link, .put_link = ocfs2_fast_put_link, diff --git a/fs/ocfs2/symlink.h b/fs/ocfs2/symlink.h index 65a6c9c..f53d1e0 100644 --- a/fs/ocfs2/symlink.h +++ b/fs/ocfs2/symlink.h @@ -26,8 +26,13 @@ #ifndef OCFS2_SYMLINK_H #define OCFS2_SYMLINK_H +#ifdef IOP_IS_NOT_CONST +extern struct inode_operations ocfs2_symlink_inode_operations; +extern struct inode_operations ocfs2_fast_symlink_inode_operations; +#else extern const struct inode_operations ocfs2_symlink_inode_operations; extern const struct inode_operations ocfs2_fast_symlink_inode_operations; +#endif /* * Test whether an inode is a fast symlink. -- 1.5.6.5 From sunil.mushran at oracle.com Tue Nov 10 17:38:22 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Tue, 10 Nov 2009 17:38:22 -0800 Subject: [Ocfs2-devel] ocfs2 1.6 - third set Message-ID: <1257903510-29198-1-git-send-email-sunil.mushran@oracle.com> The third set of patches that deal with missing const modifier in various places in the el5 kernel. From sunil.mushran at oracle.com Tue Nov 10 17:38:30 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Tue, 10 Nov 2009 17:38:30 -0800 Subject: [Ocfs2-devel] [PATCH 8/8] ocfs2: Handle missing const modifier in seq_open() In-Reply-To: <1257903510-29198-1-git-send-email-sunil.mushran@oracle.com> References: <1257903510-29198-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1257903510-29198-9-git-send-email-sunil.mushran@oracle.com> Mainline commit 15ad7cdcfd76450d4beebc789ec646664238184d added the const modifier to struct seq_operations * in seq_open(). Signed-off-by: Sunil Mushran --- Config.make.in | 1 + configure.in | 5 +++++ fs/ocfs2/cluster/Makefile | 4 ++++ fs/ocfs2/cluster/netdebug.c | 8 ++++++++ fs/ocfs2/dlm/Makefile | 4 ++++ fs/ocfs2/dlm/dlmdebug.c | 4 ++++ 6 files changed, 26 insertions(+), 0 deletions(-) diff --git a/Config.make.in b/Config.make.in index 32d99a8..2e5ff54 100644 --- a/Config.make.in +++ b/Config.make.in @@ -69,6 +69,7 @@ SOP_IS_NOT_CONST = @SOP_IS_NOT_CONST@ EXPORTOP_IS_NOT_CONST = @EXPORTOP_IS_NOT_CONST@ MATCHTABLE_IS_NOT_CONST = @MATCHTABLE_IS_NOT_CONST@ VMOP_IS_NOT_CONST = @VMOP_IS_NOT_CONST@ +SEQOP_IS_NOT_CONST = @SEQOP_IS_NOT_CONST@ OCFS_DEBUG = @OCFS_DEBUG@ diff --git a/configure.in b/configure.in index e7939c4..cdadf77 100644 --- a/configure.in +++ b/configure.in @@ -267,6 +267,11 @@ OCFS2_CHECK_KERNEL([vm_area_struct->vm_ops has the const modifier in mm.h], mm.h , VMOP_IS_NOT_CONST=yes, [^.*const struct vm_operations_struct \*vm_ops;]) AC_SUBST(VMOP_IS_NOT_CONST) +SEQOP_IS_NOT_CONST= +OCFS2_CHECK_KERNEL([seq_open() has const struct seq_operations * in seq_file.h], seq_file.h, + , SEQOP_IS_NOT_CONST=yes, [int seq_open(struct file \*, const struct seq_operations \*);]) +AC_SUBST(SEQOP_IS_NOT_CONST) + # End kapi_compat checks diff --git a/fs/ocfs2/cluster/Makefile b/fs/ocfs2/cluster/Makefile index c1f4f31..d89112d 100644 --- a/fs/ocfs2/cluster/Makefile +++ b/fs/ocfs2/cluster/Makefile @@ -22,6 +22,10 @@ ifdef NO_DELAYED_WORK_STRUCT EXTRA_CFLAGS += -DNO_DELAYED_WORK_STRUCT endif +ifdef SEQOP_IS_NOT_CONST +EXTRA_CFLAGS += -DSEQOP_IS_NOT_CONST +endif + SOURCES += \ heartbeat.c \ masklog.c \ diff --git a/fs/ocfs2/cluster/netdebug.c b/fs/ocfs2/cluster/netdebug.c index da794bc..cacd83f 100644 --- a/fs/ocfs2/cluster/netdebug.c +++ b/fs/ocfs2/cluster/netdebug.c @@ -163,7 +163,11 @@ static void nst_seq_stop(struct seq_file *seq, void *v) { } +#ifdef SEQOP_IS_NOT_CONST +static struct seq_operations nst_seq_ops = { +#else static const struct seq_operations nst_seq_ops = { +#endif .start = nst_seq_start, .next = nst_seq_next, .stop = nst_seq_stop, @@ -344,7 +348,11 @@ static void sc_seq_stop(struct seq_file *seq, void *v) { } +#ifdef SEQOP_IS_NOT_CONST +static struct seq_operations sc_seq_ops = { +#else static const struct seq_operations sc_seq_ops = { +#endif .start = sc_seq_start, .next = sc_seq_next, .stop = sc_seq_stop, diff --git a/fs/ocfs2/dlm/Makefile b/fs/ocfs2/dlm/Makefile index b70058d..122b370 100644 --- a/fs/ocfs2/dlm/Makefile +++ b/fs/ocfs2/dlm/Makefile @@ -38,6 +38,10 @@ ifdef SOP_IS_NOT_CONST EXTRA_CFLAGS += -DSOP_IS_NOT_CONST endif +ifdef SEQOP_IS_NOT_CONST +EXTRA_CFLAGS += -DSEQOP_IS_NOT_CONST +endif + DLM_SOURCES += \ dlmast.c \ dlmconvert.c \ diff --git a/fs/ocfs2/dlm/dlmdebug.c b/fs/ocfs2/dlm/dlmdebug.c index 42b0bad..f18afe9 100644 --- a/fs/ocfs2/dlm/dlmdebug.c +++ b/fs/ocfs2/dlm/dlmdebug.c @@ -682,7 +682,11 @@ static int lockres_seq_show(struct seq_file *s, void *v) return 0; } +#ifdef SEQOP_IS_NOT_CONST +static struct seq_operations debug_lockres_ops = { +#else static const struct seq_operations debug_lockres_ops = { +#endif .start = lockres_seq_start, .stop = lockres_seq_stop, .next = lockres_seq_next, -- 1.5.6.5 From Joel.Becker at oracle.com Tue Nov 10 18:57:46 2009 From: Joel.Becker at oracle.com (Joel Becker) Date: Tue, 10 Nov 2009 18:57:46 -0800 Subject: [Ocfs2-devel] [PATCH 01/10] ocfs2: Handle workqueue changes In-Reply-To: <1257818413-32014-2-git-send-email-sunil.mushran@oracle.com> References: <1257818413-32014-1-git-send-email-sunil.mushran@oracle.com> <1257818413-32014-2-git-send-email-sunil.mushran@oracle.com> Message-ID: <20091111025746.GB17774@mail.oracle.com> On Mon, Nov 09, 2009 at 06:00:04PM -0800, Sunil Mushran wrote: > diff --git a/kapi-compat/include/workqueue.h b/kapi-compat/include/workqueue.h > new file mode 100644 > index 0000000..24dfe2d > --- /dev/null > +++ b/kapi-compat/include/workqueue.h > @@ -0,0 +1,17 @@ > +#ifndef KAPI_WORKQUEUE_H > +#define KAPI_WORKQUEUE_H > + > +#ifdef NO_DELAYED_WORK_STRUCT > +# define delayed_work work_struct > +typedef void kapi_work_struct_t; > +# define work_to_object(a, b, c) (a) > +# define KAPI_INIT_WORK(a, b, c) INIT_WORK(a, b, c) > +# define KAPI_INIT_DELAYED_WORK(a, b, c) INIT_WORK(a, b, c) > +#else > +typedef struct work_struct kapi_work_struct_t; > +# define work_to_object(a, b, c) container_of(a, b, c) > +# define KAPI_INIT_WORK(a, b, c) INIT_WORK(a, b) > +# define KAPI_INIT_DELAYED_WORK(a, b, c) INIT_DELAYED_WORK(a, b) > +#endif > + > +#endif Rather than include kapi-compat/include/workqueue.h at all times, I'd really like to only include it when necessary. That way you can build the driver against mainline even when there is no kapi-compat directory. Can't we have an fs/ocfs2/kapi-default.h that has defines for when we're against mainline? Include it from fs/ocfs2/ocfs2.h. For this patch, it would include: #ifndef KAPI_INIT_WORK typedef struct work_struct kapi_work_struct_t; # define work_to_object(a, b, c) container_of(a, b, c) # define KAPI_INIT_WORK(a, b, c) INIT_WORK(a, b) # define KAPI_INIT_DELAYED_WORK(a, b, c) INIT_DELAYED_WORK(a, b) #endif Joel -- #!/bin/perl -sp0777i References: <1257818413-32014-1-git-send-email-sunil.mushran@oracle.com> <1257818413-32014-3-git-send-email-sunil.mushran@oracle.com> Message-ID: <20091111025956.GC17774@mail.oracle.com> On Mon, Nov 09, 2009 at 06:00:05PM -0800, Sunil Mushran wrote: > Mainline commit d69a3ad6a0e47b2aa9b2b2ddfd385752132a4d34 split > lock mode and flag constants from dlm.h into a sharable header, > dlmconstants.h. > > This patch adds a header with the same name that merely includes > dlm.h. Again you're including the kapi-compat header unconditionally. Only include it when it is necessary. > +#ifdef NO_DLMCONSTANTS_HEADER > +#include > +#include Then maybe change this to #ifndef DLM_LOCK_NL # include #endif Joel -- "In the arms of the angel, fly away from here, From this dark, cold hotel room and the endlessness that you fear. You are pulled from the wreckage of your silent reverie. In the arms of the angel, may you find some comfort here." Joel Becker Principal Software Developer Oracle E-mail: joel.becker at oracle.com Phone: (650) 506-8127 From Joel.Becker at oracle.com Tue Nov 10 19:03:35 2009 From: Joel.Becker at oracle.com (Joel Becker) Date: Tue, 10 Nov 2009 19:03:35 -0800 Subject: [Ocfs2-devel] [PATCH 07/10] ocfs2: Handle struct f_path in struct file In-Reply-To: <1257818413-32014-8-git-send-email-sunil.mushran@oracle.com> References: <1257818413-32014-1-git-send-email-sunil.mushran@oracle.com> <1257818413-32014-8-git-send-email-sunil.mushran@oracle.com> Message-ID: <20091111030334.GD17774@mail.oracle.com> On Mon, Nov 09, 2009 at 06:00:10PM -0800, Sunil Mushran wrote: > Mainline commit 0f7fc9e4d03987fe29f6dd4aa67e4c56eb7ecb05 added > struct path into struct file. Again, put #ifndef filp_dentry() in fs/ocfs2/kapi-defaults.h and only include kapi-include/fpath.h if necessary. Joel -- "Get right to the heart of matters. It's the heart that matters more." Joel Becker Principal Software Developer Oracle E-mail: joel.becker at oracle.com Phone: (650) 506-8127 From Joel.Becker at oracle.com Tue Nov 10 19:13:14 2009 From: Joel.Becker at oracle.com (Joel Becker) Date: Tue, 10 Nov 2009 19:13:14 -0800 Subject: [Ocfs2-devel] [PATCH 10/10] ocfs2: Handle different f_version types In-Reply-To: <1257818413-32014-11-git-send-email-sunil.mushran@oracle.com> References: <1257818413-32014-1-git-send-email-sunil.mushran@oracle.com> <1257818413-32014-11-git-send-email-sunil.mushran@oracle.com> Message-ID: <20091111031313.GE17774@mail.oracle.com> On Mon, Nov 09, 2009 at 06:00:13PM -0800, Sunil Mushran wrote: > Mainline commit 2b47c3611de05c585e2d81204f6c7e3e255a3461 changed type of > file->f_version from unsigned long to u64. This patch allows building with > kernels having either definition. Build fails if the type is something else. I was trying to come up with a way to not create f_version_t. You know, pass around a u64 and cast it when comparing to inode->i_version. But I'm not terribly happy with that, so I guess we leave f_version_t. Please reorganize it so that kapi-include/ is not needed for mainline. Joel -- "In the beginning, the universe was created. This has made a lot of people very angry, and is generally considered to have been a bad move." - Douglas Adams Joel Becker Principal Software Developer Oracle E-mail: joel.becker at oracle.com Phone: (650) 506-8127 From Joel.Becker at oracle.com Tue Nov 10 19:25:06 2009 From: Joel.Becker at oracle.com (Joel Becker) Date: Tue, 10 Nov 2009 19:25:06 -0800 Subject: [Ocfs2-devel] ocfs2 1.6 - third set In-Reply-To: <1257903510-29198-1-git-send-email-sunil.mushran@oracle.com> References: <1257903510-29198-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <20091111032505.GF17774@mail.oracle.com> On Tue, Nov 10, 2009 at 05:38:22PM -0800, Sunil Mushran wrote: > The third set of patches that deal with missing const modifier in various > places in the el5 kernel. Ack. Joel -- Life's Little Instruction Book #452 "Never compromise your integrity." Joel Becker Principal Software Developer Oracle E-mail: joel.becker at oracle.com Phone: (650) 506-8127 From sunil.mushran at oracle.com Wed Nov 11 10:11:30 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Wed, 11 Nov 2009 10:11:30 -0800 Subject: [Ocfs2-devel] [PATCH 01/10] ocfs2: Handle workqueue changes In-Reply-To: <20091111025746.GB17774@mail.oracle.com> References: <1257818413-32014-1-git-send-email-sunil.mushran@oracle.com> <1257818413-32014-2-git-send-email-sunil.mushran@oracle.com> <20091111025746.GB17774@mail.oracle.com> Message-ID: <4AFAFE52.3040305@oracle.com> Joel Becker wrote: > Rather than include kapi-compat/include/workqueue.h at all > times, I'd really like to only include it when necessary. That way you > can build the driver against mainline even when there is no kapi-compat > directory. > Can't we have an fs/ocfs2/kapi-default.h that has defines for > when we're against mainline? Include it from fs/ocfs2/ocfs2.h. For > this patch, it would include: > > #ifndef KAPI_INIT_WORK > typedef struct work_struct kapi_work_struct_t; > # define work_to_object(a, b, c) container_of(a, b, c) > # define KAPI_INIT_WORK(a, b, c) INIT_WORK(a, b) > # define KAPI_INIT_DELAYED_WORK(a, b, c) INIT_DELAYED_WORK(a, b) > #endif > Yeah, that's a good idea. From sunil.mushran at oracle.com Wed Nov 11 11:27:32 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Wed, 11 Nov 2009 11:27:32 -0800 Subject: [Ocfs2-devel] [PATCH 02/10] ocfs2: Handle missing dlmconstants.h In-Reply-To: <20091111025956.GC17774@mail.oracle.com> References: <1257818413-32014-1-git-send-email-sunil.mushran@oracle.com> <1257818413-32014-3-git-send-email-sunil.mushran@oracle.com> <20091111025956.GC17774@mail.oracle.com> Message-ID: <4AFB1024.3050707@oracle.com> Joel Becker wrote: > Again you're including the kapi-compat header unconditionally. > Only include it when it is necessary. > Ok. > >> +#ifdef NO_DLMCONSTANTS_HEADER >> +#include >> +#include >> > > Then maybe change this to > > #ifndef DLM_LOCK_NL > # include > #endif > Not sure why we need to do this. From sunil.mushran at oracle.com Wed Nov 11 12:44:57 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Wed, 11 Nov 2009 12:44:57 -0800 Subject: [Ocfs2-devel] [PATCH 08/11] ocfs2: Handle struct f_path in struct file In-Reply-To: <1257972298-15590-1-git-send-email-sunil.mushran@oracle.com> References: <1257972298-15590-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1257972298-15590-5-git-send-email-sunil.mushran@oracle.com> Mainline commit 0f7fc9e4d03987fe29f6dd4aa67e4c56eb7ecb05 added struct path into struct file. Signed-off-by: Sunil Mushran --- Config.make.in | 1 + Makefile | 3 ++- configure.in | 6 ++++++ fs/ocfs2/Makefile | 4 ++++ fs/ocfs2/aops.c | 4 ++-- fs/ocfs2/dir.c | 2 +- fs/ocfs2/dlm/Makefile | 4 ++++ fs/ocfs2/dlm/dlmfs.c | 4 ++-- fs/ocfs2/file.c | 36 ++++++++++++++++++------------------ fs/ocfs2/ioctl.c | 6 +++--- fs/ocfs2/kapi-default.h | 5 +++++ fs/ocfs2/mmap.c | 8 ++++---- kapi-compat/include/fpath.h | 9 +++++++++ 13 files changed, 61 insertions(+), 31 deletions(-) create mode 100644 kapi-compat/include/fpath.h diff --git a/Config.make.in b/Config.make.in index 33b7a89..eb8e2a9 100644 --- a/Config.make.in +++ b/Config.make.in @@ -59,6 +59,7 @@ EXTRA_CFLAGS += @KAPI_COMPAT_CFLAGS@ NO_DELAYED_WORK_STRUCT = @NO_DELAYED_WORK_STRUCT@ NO_DLMCONSTANTS_HEADER = @NO_DLMCONSTANTS_HEADER@ +NO_F_PATH_IN_STRUCT_FILE = @NO_F_PATH_IN_STRUCT_FILE@ OCFS_DEBUG = @OCFS_DEBUG@ diff --git a/Makefile b/Makefile index 8e58c5d..6a28531 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/dlmconstants.h \ kapi-compat/include/task_pid_nr.h \ kapi-compat/include/current_umask.h \ - kapi-compat/include/sync_mapping.h + kapi-compat/include/sync_mapping.h \ + kapi-compat/include/fpath.h PATCH_FILES = diff --git a/configure.in b/configure.in index b543a9d..46f1f96 100644 --- a/configure.in +++ b/configure.in @@ -193,6 +193,12 @@ if test "x$do_sync_mapping_range" = "x" ; then KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS sync_mapping.h" fi +NO_F_PATH_IN_STRUCT_FILE= +OCFS2_CHECK_KERNEL([f_path in fs.h], fs.h, + , NO_F_PATH_IN_STRUCT_FILE=fpath.h, [struct path.*f_path]) +AC_SUBST(NO_F_PATH_IN_STRUCT_FILE) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $NO_F_PATH_IN_STRUCT_FILE" + # End kapi_compat checks diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile index b2a0a7a..07d2064 100644 --- a/fs/ocfs2/Makefile +++ b/fs/ocfs2/Makefile @@ -44,6 +44,10 @@ ifdef NO_DLMCONSTANTS_HEADER EXTRA_CFLAGS += -DNO_DLMCONSTANTS_HEADER endif +ifdef NO_F_PATH_IN_STRUCT_FILE +EXTRA_CFLAGS += -DNO_F_PATH_IN_STRUCT_FILE +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes. diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c index deb2b13..67a3731 100644 --- a/fs/ocfs2/aops.c +++ b/fs/ocfs2/aops.c @@ -636,7 +636,7 @@ static void ocfs2_dio_end_io(struct kiocb *iocb, ssize_t bytes, void *private) { - struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode; + struct inode *inode = filp_dentry(iocb->ki_filp)->d_inode; int level; /* this io's submitter should not have unlocked this before we could */ @@ -678,7 +678,7 @@ static ssize_t ocfs2_direct_IO(int rw, unsigned long nr_segs) { struct file *file = iocb->ki_filp; - struct inode *inode = file->f_path.dentry->d_inode->i_mapping->host; + struct inode *inode = filp_dentry(file)->d_inode->i_mapping->host; int ret; mlog_entry_void(); diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c index 28c3ec2..69b3402 100644 --- a/fs/ocfs2/dir.c +++ b/fs/ocfs2/dir.c @@ -2025,7 +2025,7 @@ int ocfs2_dir_foreach(struct inode *inode, loff_t *f_pos, void *priv, int ocfs2_readdir(struct file * filp, void * dirent, filldir_t filldir) { int error = 0; - struct inode *inode = filp->f_path.dentry->d_inode; + struct inode *inode = filp_dentry(filp)->d_inode; int lock_level = 0; mlog_entry("dirino=%llu\n", diff --git a/fs/ocfs2/dlm/Makefile b/fs/ocfs2/dlm/Makefile index 44b6cc6..a42d35d 100644 --- a/fs/ocfs2/dlm/Makefile +++ b/fs/ocfs2/dlm/Makefile @@ -26,6 +26,10 @@ ifdef NO_DELAYED_WORK_STRUCT EXTRA_CFLAGS += -DNO_DELAYED_WORK_STRUCT endif +ifdef NO_F_PATH_IN_STRUCT_FILE +EXTRA_CFLAGS += -DNO_F_PATH_IN_STRUCT_FILE +endif + DLM_SOURCES += \ dlmast.c \ dlmconvert.c \ diff --git a/fs/ocfs2/dlm/dlmfs.c b/fs/ocfs2/dlm/dlmfs.c index 02bf178..8e293fa 100644 --- a/fs/ocfs2/dlm/dlmfs.c +++ b/fs/ocfs2/dlm/dlmfs.c @@ -187,7 +187,7 @@ static ssize_t dlmfs_file_read(struct file *filp, int bytes_left; ssize_t readlen; char *lvb_buf; - struct inode *inode = filp->f_path.dentry->d_inode; + struct inode *inode = filp_dentry(filp)->d_inode; mlog(0, "inode %lu, count = %zu, *ppos = %llu\n", inode->i_ino, count, *ppos); @@ -231,7 +231,7 @@ static ssize_t dlmfs_file_write(struct file *filp, int bytes_left; ssize_t writelen; char *lvb_buf; - struct inode *inode = filp->f_path.dentry->d_inode; + struct inode *inode = filp_dentry(filp)->d_inode; mlog(0, "inode %lu, count = %zu, *ppos = %llu\n", inode->i_ino, count, *ppos); diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 89fc8ee..68bf44f 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c @@ -105,7 +105,7 @@ static int ocfs2_file_open(struct inode *inode, struct file *file) struct ocfs2_inode_info *oi = OCFS2_I(inode); mlog_entry("(0x%p, 0x%p, '%.*s')\n", inode, file, - file->f_path.dentry->d_name.len, file->f_path.dentry->d_name.name); + filp_dentry(file)->d_name.len, filp_dentry(file)->d_name.name); spin_lock(&oi->ip_lock); @@ -146,8 +146,8 @@ static int ocfs2_file_release(struct inode *inode, struct file *file) struct ocfs2_inode_info *oi = OCFS2_I(inode); mlog_entry("(0x%p, 0x%p, '%.*s')\n", inode, file, - file->f_path.dentry->d_name.len, - file->f_path.dentry->d_name.name); + filp_dentry(file)->d_name.len, + filp_dentry(file)->d_name.name); spin_lock(&oi->ip_lock); if (!--oi->ip_open_count) @@ -1593,7 +1593,7 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode, } } - if (file && should_remove_suid(file->f_path.dentry)) { + if (file && should_remove_suid(filp_dentry(file))) { ret = __ocfs2_write_remove_suid(inode, di_bh); if (ret) { mlog_errno(ret); @@ -1660,7 +1660,7 @@ out: int ocfs2_change_file_space(struct file *file, unsigned int cmd, struct ocfs2_space_resv *sr) { - struct inode *inode = file->f_path.dentry->d_inode; + struct inode *inode = filp_dentry(file)->d_inode; struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); if ((cmd == OCFS2_IOC_RESVSP || cmd == OCFS2_IOC_RESVSP64) && @@ -1905,13 +1905,13 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb, loff_t old_size, *ppos = &iocb->ki_pos; u32 old_clusters; struct file *file = iocb->ki_filp; - struct inode *inode = file->f_path.dentry->d_inode; + struct inode *inode = filp_dentry(file)->d_inode; struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); mlog_entry("(0x%p, %u, '%.*s')\n", file, (unsigned int)nr_segs, - file->f_path.dentry->d_name.len, - file->f_path.dentry->d_name.name); + filp_dentry(file)->d_name.len, + filp_dentry(file)->d_name.name); if (iocb->ki_left == 0) return 0; @@ -1939,7 +1939,7 @@ relock: } can_do_direct = direct_io; - ret = ocfs2_prepare_inode_for_write(file->f_path.dentry, ppos, + ret = ocfs2_prepare_inode_for_write(filp_dentry(file), ppos, iocb->ki_left, appending, &can_do_direct); if (ret < 0) { @@ -2060,7 +2060,7 @@ static int ocfs2_splice_to_file(struct pipe_inode_info *pipe, { int ret; - ret = ocfs2_prepare_inode_for_write(out->f_path.dentry, &sd->pos, + ret = ocfs2_prepare_inode_for_write(filp_dentry(out), &sd->pos, sd->total_len, 0, NULL); if (ret < 0) { mlog_errno(ret); @@ -2088,8 +2088,8 @@ static ssize_t ocfs2_file_splice_write(struct pipe_inode_info *pipe, mlog_entry("(0x%p, 0x%p, %u, '%.*s')\n", out, pipe, (unsigned int)len, - out->f_path.dentry->d_name.len, - out->f_path.dentry->d_name.name); + filp_dentry(out)->d_name.len, + filp_dentry(out)->d_name.name); if (pipe->inode) mutex_lock_nested(&pipe->inode->i_mutex, I_MUTEX_PARENT); @@ -2144,12 +2144,12 @@ static ssize_t ocfs2_file_splice_read(struct file *in, unsigned int flags) { int ret = 0, lock_level = 0; - struct inode *inode = in->f_path.dentry->d_inode; + struct inode *inode = filp_dentry(in)->d_inode; mlog_entry("(0x%p, 0x%p, %u, '%.*s')\n", in, pipe, (unsigned int)len, - in->f_path.dentry->d_name.len, - in->f_path.dentry->d_name.name); + filp_dentry(in)->d_name.len, + filp_dentry(in)->d_name.name); /* * See the comment in ocfs2_file_aio_read() @@ -2175,12 +2175,12 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb, { int ret = 0, rw_level = -1, have_alloc_sem = 0, lock_level = 0; struct file *filp = iocb->ki_filp; - struct inode *inode = filp->f_path.dentry->d_inode; + struct inode *inode = filp_dentry(filp)->d_inode; mlog_entry("(0x%p, %u, '%.*s')\n", filp, (unsigned int)nr_segs, - filp->f_path.dentry->d_name.len, - filp->f_path.dentry->d_name.name); + filp_dentry(filp)->d_name.len, + filp_dentry(filp)->d_name.name); if (!inode) { ret = -EINVAL; diff --git a/fs/ocfs2/ioctl.c b/fs/ocfs2/ioctl.c index 31fbb06..857b409 100644 --- a/fs/ocfs2/ioctl.c +++ b/fs/ocfs2/ioctl.c @@ -110,7 +110,7 @@ bail: long ocfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { - struct inode *inode = filp->f_path.dentry->d_inode; + struct inode *inode = filp_dentry(filp)->d_inode; unsigned int flags; int new_clusters; int status; @@ -132,12 +132,12 @@ long ocfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) if (get_user(flags, (int __user *) arg)) return -EFAULT; - status = mnt_want_write(filp->f_path.mnt); + status = mnt_want_write(filp_mnt(filp)); if (status) return status; status = ocfs2_set_inode_attr(inode, flags, OCFS2_FL_MODIFIABLE); - mnt_drop_write(filp->f_path.mnt); + mnt_drop_write(filp_mnt(filp)); return status; case OCFS2_IOC_RESVSP: case OCFS2_IOC_RESVSP64: diff --git a/fs/ocfs2/kapi-default.h b/fs/ocfs2/kapi-default.h index 21e5e3a..bb642ae 100644 --- a/fs/ocfs2/kapi-default.h +++ b/fs/ocfs2/kapi-default.h @@ -29,4 +29,9 @@ typedef struct work_struct kapi_work_struct_t; # define KAPI_INIT_DELAYED_WORK(a, b, c) INIT_DELAYED_WORK(a, b) #endif +#ifndef filp_dentry +# define filp_dentry(i) (i)->f_path.dentry +# define filp_mnt(i) (i)->f_path.mnt +#endif + #endif diff --git a/fs/ocfs2/mmap.c b/fs/ocfs2/mmap.c index 3973761..55afd11 100644 --- a/fs/ocfs2/mmap.c +++ b/fs/ocfs2/mmap.c @@ -157,7 +157,7 @@ out: static int ocfs2_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) { struct page *page = vmf->page; - struct inode *inode = vma->vm_file->f_path.dentry->d_inode; + struct inode *inode = filp_dentry(vma->vm_file)->d_inode; struct buffer_head *di_bh = NULL; sigset_t blocked, oldset; int ret, ret2; @@ -211,13 +211,13 @@ int ocfs2_mmap(struct file *file, struct vm_area_struct *vma) { int ret = 0, lock_level = 0; - ret = ocfs2_inode_lock_atime(file->f_dentry->d_inode, - file->f_vfsmnt, &lock_level); + ret = ocfs2_inode_lock_atime(filp_dentry(file)->d_inode, + filp_mnt(file), &lock_level); if (ret < 0) { mlog_errno(ret); goto out; } - ocfs2_inode_unlock(file->f_dentry->d_inode, lock_level); + ocfs2_inode_unlock(filp_dentry(file)->d_inode, lock_level); out: vma->vm_ops = &ocfs2_file_vm_ops; vma->vm_flags |= VM_CAN_NONLINEAR; diff --git a/kapi-compat/include/fpath.h b/kapi-compat/include/fpath.h new file mode 100644 index 0000000..52a1655 --- /dev/null +++ b/kapi-compat/include/fpath.h @@ -0,0 +1,9 @@ +#ifndef KAPI_FPATH_H +#define KAPI_FPATH_H + +#ifdef NO_F_PATH_IN_STRUCT_FILE +# define filp_dentry(i) (i)->f_dentry +# define filp_mnt(i) (i)->f_vfsmnt +#endif + +#endif -- 1.5.6.5 From sunil.mushran at oracle.com Wed Nov 11 12:44:54 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Wed, 11 Nov 2009 12:44:54 -0800 Subject: [Ocfs2-devel] [PATCH 01/11] ocfs2: Add kapi-default.h In-Reply-To: <1257972298-15590-1-git-send-email-sunil.mushran@oracle.com> References: <1257972298-15590-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1257972298-15590-2-git-send-email-sunil.mushran@oracle.com> Add kapi-default.h to allow us to build ocfs2 1.6 against mainline without the kapi-compat headers. Signed-off-by: Sunil Mushran --- fs/ocfs2/Makefile | 2 +- fs/ocfs2/kapi-default.h | 26 ++++++++++++++++++++++++++ fs/ocfs2/ocfs2.h | 2 ++ 3 files changed, 29 insertions(+), 1 deletions(-) create mode 100644 fs/ocfs2/kapi-default.h diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile index 8222d03..9ca23b4 100644 --- a/fs/ocfs2/Makefile +++ b/fs/ocfs2/Makefile @@ -13,7 +13,7 @@ include $(OUR_TOPDIR)/Config.make endif COMPAT_SOURCES = -COMPAT_HEADERS = +COMPAT_HEADERS = kapi-default.h FS_SOURCES = FS_HEADERS = GLUE_SOURCES = diff --git a/fs/ocfs2/kapi-default.h b/fs/ocfs2/kapi-default.h new file mode 100644 index 0000000..fcf3ac9 --- /dev/null +++ b/fs/ocfs2/kapi-default.h @@ -0,0 +1,26 @@ +/* -*- mode: c; c-basic-offset: 8; -*- + * vim: noexpandtab sw=8 ts=8 sts=0: + * + * kapi-default.h + * + * Defines kapi-compat macros and structures used in OCFS2 + * + * Copyright (C) 2009 Oracle. All rights reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + */ + +#ifndef KAPI_DEFAULT_H +#define KAPI_DEFAULT_H + + +#endif diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h index eae4046..89ed209 100644 --- a/fs/ocfs2/ocfs2.h +++ b/fs/ocfs2/ocfs2.h @@ -42,6 +42,8 @@ # include "ocfs2_jbd_compat.h" #endif +#include "kapi-default.h" + /* For union ocfs2_dlm_lksb */ #include "stackglue.h" -- 1.5.6.5 From sunil.mushran at oracle.com Wed Nov 11 12:44:58 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Wed, 11 Nov 2009 12:44:58 -0800 Subject: [Ocfs2-devel] [PATCH 11/11] ocfs2: Handle different f_version types In-Reply-To: <1257972298-15590-1-git-send-email-sunil.mushran@oracle.com> References: <1257972298-15590-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1257972298-15590-6-git-send-email-sunil.mushran@oracle.com> Mainline commit 2b47c3611de05c585e2d81204f6c7e3e255a3461 changed type of file->f_version from unsigned long to u64. This patch allows building with kernels having either definition. Build fails if the type is something else. Signed-off-by: Sunil Mushran --- Config.make.in | 1 + Makefile | 3 ++- configure.in | 14 ++++++++++++++ fs/ocfs2/Makefile | 4 ++++ fs/ocfs2/dir.c | 12 ++++++------ fs/ocfs2/kapi-default.h | 5 +++++ kapi-compat/include/fversion.h | 9 +++++++++ 7 files changed, 41 insertions(+), 7 deletions(-) create mode 100644 kapi-compat/include/fversion.h diff --git a/Config.make.in b/Config.make.in index aead755..ba72950 100644 --- a/Config.make.in +++ b/Config.make.in @@ -61,6 +61,7 @@ NO_DELAYED_WORK_STRUCT = @NO_DELAYED_WORK_STRUCT@ NO_DLMCONSTANTS_HEADER = @NO_DLMCONSTANTS_HEADER@ NO_F_PATH_IN_STRUCT_FILE = @NO_F_PATH_IN_STRUCT_FILE@ ADDRESS_SPACE_OPS_EXT = @ADDRESS_SPACE_OPS_EXT@ +FVERSION_IS_ULONG = @FVERSION_IS_ULONG@ OCFS_DEBUG = @OCFS_DEBUG@ diff --git a/Makefile b/Makefile index 6e28427..06ddabf 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/current_umask.h \ kapi-compat/include/sync_mapping.h \ kapi-compat/include/fpath.h \ - kapi-compat/include/ushortmax.h + kapi-compat/include/ushortmax.h \ + kapi-compat/include/fversion.h PATCH_FILES = diff --git a/configure.in b/configure.in index d5a0b17..2015fbb 100644 --- a/configure.in +++ b/configure.in @@ -217,6 +217,20 @@ OCFS2_CHECK_KERNEL([USHORT_MAX in kernel.h], kernel.h, , ushort_max_compat_header="ushortmax.h", [#define USHORT_MAX]) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $ushort_max_compat_header" +FVERSION_IS_ULONG= +OCFS2_CHECK_KERNEL([ f_version is type unsigned long in fs.h], fs.h, + FVERSION_IS_ULONG=fversion.h, , [unsigned long.*f_version;]) +AC_SUBST(FVERSION_IS_ULONG) +if test "x$FVERSION_IS_ULONG" = "x" ; then + fversion_is_u64= + OCFS2_CHECK_KERNEL([ f_version is type u64 in fs.h], fs.h, + fversion_is_u64=yes, , [u64.*f_version;]) + if test "x$fversion_is_u64" = "x" ; then + AC_MSG_ERROR(Cannot build with kernel in which f_version type is neither unsigned long nor u64) + fi +fi +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $FVERSION_IS_ULONG" + # End kapi_compat checks diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile index 96f2fb0..dbe0e75 100644 --- a/fs/ocfs2/Makefile +++ b/fs/ocfs2/Makefile @@ -52,6 +52,10 @@ ifdef ADDRESS_SPACE_OPS_EXT EXTRA_CFLAGS += -DADDRESS_SPACE_OPS_EXT endif +ifdef FVERSION_IS_ULONG +EXTRA_CFLAGS += -DFVERSION_IS_ULONG +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes. diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c index 69b3402..b8991ac 100644 --- a/fs/ocfs2/dir.c +++ b/fs/ocfs2/dir.c @@ -1771,7 +1771,7 @@ bail: } static int ocfs2_dir_foreach_blk_id(struct inode *inode, - u64 *f_version, + f_version_t *f_version, loff_t *f_pos, void *priv, filldir_t filldir, int *filldir_err) { @@ -1832,7 +1832,7 @@ revalidate: * not the directory has been modified * during the copy operation. */ - u64 version = *f_version; + f_version_t version = *f_version; unsigned char d_type = DT_UNKNOWN; if (de->file_type < OCFS2_FT_MAX) @@ -1865,7 +1865,7 @@ out: * and indexed ones. */ static int ocfs2_dir_foreach_blk_el(struct inode *inode, - u64 *f_version, + f_version_t *f_version, loff_t *f_pos, void *priv, filldir_t filldir, int *filldir_err) { @@ -1952,7 +1952,7 @@ revalidate: * not the directory has been modified * during the copy operation. */ - unsigned long version = *f_version; + f_version_t version = *f_version; unsigned char d_type = DT_UNKNOWN; if (de->file_type < OCFS2_FT_MAX) @@ -1983,7 +1983,7 @@ out: return stored; } -static int ocfs2_dir_foreach_blk(struct inode *inode, u64 *f_version, +static int ocfs2_dir_foreach_blk(struct inode *inode, f_version_t *f_version, loff_t *f_pos, void *priv, filldir_t filldir, int *filldir_err) { @@ -2003,7 +2003,7 @@ int ocfs2_dir_foreach(struct inode *inode, loff_t *f_pos, void *priv, filldir_t filldir) { int ret = 0, filldir_err = 0; - u64 version = inode->i_version; + f_version_t version = inode->i_version; while (*f_pos < i_size_read(inode)) { ret = ocfs2_dir_foreach_blk(inode, &version, f_pos, priv, diff --git a/fs/ocfs2/kapi-default.h b/fs/ocfs2/kapi-default.h index bb642ae..3f04924 100644 --- a/fs/ocfs2/kapi-default.h +++ b/fs/ocfs2/kapi-default.h @@ -34,4 +34,9 @@ typedef struct work_struct kapi_work_struct_t; # define filp_mnt(i) (i)->f_path.mnt #endif +#ifndef F_VERSION_DEFINED +#define F_VERSION_DEFINED +typedef u64 f_version_t; +#endif + #endif diff --git a/kapi-compat/include/fversion.h b/kapi-compat/include/fversion.h new file mode 100644 index 0000000..a3fa9e9 --- /dev/null +++ b/kapi-compat/include/fversion.h @@ -0,0 +1,9 @@ +#ifndef KAPI_FVERSION_H +#define KAPI_FVERSION_H + +#ifdef FVERSION_IS_ULONG +# define F_VERSION_DEFINED +typedef unsigned long f_version_t; +#endif + +#endif -- 1.5.6.5 From sunil.mushran at oracle.com Wed Nov 11 12:44:53 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Wed, 11 Nov 2009 12:44:53 -0800 Subject: [Ocfs2-devel] ocfs2 1.6 - second set (2nd attempt) Message-ID: <1257972298-15590-1-git-send-email-sunil.mushran@oracle.com> Added kapi-default.h to enable us to not have to include kapi-compat headers when building against mainline. Sunil From sunil.mushran at oracle.com Wed Nov 11 12:44:56 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Wed, 11 Nov 2009 12:44:56 -0800 Subject: [Ocfs2-devel] [PATCH 03/11] ocfs2: Handle missing dlmconstants.h In-Reply-To: <1257972298-15590-1-git-send-email-sunil.mushran@oracle.com> References: <1257972298-15590-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1257972298-15590-4-git-send-email-sunil.mushran@oracle.com> Mainline commit d69a3ad6a0e47b2aa9b2b2ddfd385752132a4d34 split lock mode and flag constants from dlm.h into a sharable header, dlmconstants.h. This patch adds a header with the same name that merely includes dlm.h. Signed-off-by: Sunil Mushran --- Config.make.in | 1 + Makefile | 3 ++- configure.in | 6 ++++++ fs/ocfs2/Makefile | 4 ++++ fs/ocfs2/stackglue.h | 2 ++ kapi-compat/include/dlmconstants.h | 9 +++++++++ 6 files changed, 24 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/dlmconstants.h diff --git a/Config.make.in b/Config.make.in index cf292b6..33b7a89 100644 --- a/Config.make.in +++ b/Config.make.in @@ -58,6 +58,7 @@ MAKEBO_VERSION = @VERSION@ EXTRA_CFLAGS += @KAPI_COMPAT_CFLAGS@ NO_DELAYED_WORK_STRUCT = @NO_DELAYED_WORK_STRUCT@ +NO_DLMCONSTANTS_HEADER = @NO_DLMCONSTANTS_HEADER@ OCFS_DEBUG = @OCFS_DEBUG@ diff --git a/Makefile b/Makefile index 262bc49..d038ae9 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,8 @@ SUBDIRS = fs vendor LINUX_INCLUDE_FILES = KAPI_COMPAT_FILES = \ - kapi-compat/include/workqueue.h + kapi-compat/include/workqueue.h \ + kapi-compat/include/dlmconstants.h PATCH_FILES = diff --git a/configure.in b/configure.in index e4628a7..3528514 100644 --- a/configure.in +++ b/configure.in @@ -164,6 +164,12 @@ OCFS2_CHECK_KERNEL([struct delayed_work in workqueue.h], workqueue.h, AC_SUBST(NO_DELAYED_WORK_STRUCT) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $NO_DELAYED_WORK_STRUCT" +NO_DLMCONSTANTS_HEADER= +OCFS2_CHECK_KERNEL([dlmconstants.h], dlmconstants.h, + , NO_DLMCONSTANTS_HEADER=dlmconstants.h, [__DLMCONSTANTS_DOT_H__]) +AC_SUBST(NO_DLMCONSTANTS_HEADER) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $NO_DLMCONSTANTS_HEADER" + # End kapi_compat checks diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile index 4e4f49a..5f969fe 100644 --- a/fs/ocfs2/Makefile +++ b/fs/ocfs2/Makefile @@ -38,6 +38,10 @@ ifdef NO_DELAYED_WORK_STRUCT EXTRA_CFLAGS += -DNO_DELAYED_WORK_STRUCT endif +ifdef NO_DLMCONSTANTS_HEADER +EXTRA_CFLAGS += -DNO_DLMCONSTANTS_HEADER +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes. diff --git a/fs/ocfs2/stackglue.h b/fs/ocfs2/stackglue.h index 03a44d6..52d1a1d 100644 --- a/fs/ocfs2/stackglue.h +++ b/fs/ocfs2/stackglue.h @@ -23,7 +23,9 @@ #include #include +#ifndef NO_DLMCONSTANTS_HEADER #include +#endif #include "dlm/dlmapi.h" #include diff --git a/kapi-compat/include/dlmconstants.h b/kapi-compat/include/dlmconstants.h new file mode 100644 index 0000000..19e92c9 --- /dev/null +++ b/kapi-compat/include/dlmconstants.h @@ -0,0 +1,9 @@ +#ifndef KAPI_DLMCONSTANTS_H +#define KAPI_DLMCONSTANTS_H + +#ifdef NO_DLMCONSTANTS_HEADER +#include +#include +#endif + +#endif -- 1.5.6.5 From sunil.mushran at oracle.com Wed Nov 11 12:44:55 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Wed, 11 Nov 2009 12:44:55 -0800 Subject: [Ocfs2-devel] [PATCH 02/11] ocfs2: Handle workqueue changes In-Reply-To: <1257972298-15590-1-git-send-email-sunil.mushran@oracle.com> References: <1257972298-15590-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1257972298-15590-3-git-send-email-sunil.mushran@oracle.com> Mainline commit 52bad64d95bd89e08c49ec5a071fa6dcbe5a1a9c introduced struct delayed_work to separate delayable and non-delayable work. Signed-off-by: Sunil Mushran --- Config.make.in | 2 + Makefile | 3 +- configure.in | 6 +++ fs/ocfs2/Makefile | 4 ++ fs/ocfs2/alloc.c | 11 +++--- fs/ocfs2/cluster/Makefile | 4 ++ fs/ocfs2/cluster/heartbeat.c | 10 +++--- fs/ocfs2/cluster/quorum.c | 4 +- fs/ocfs2/cluster/tcp.c | 65 ++++++++++++++++++++------------------ fs/ocfs2/dcache.c | 6 ++-- fs/ocfs2/dcache.h | 2 +- fs/ocfs2/dlm/Makefile | 4 ++ fs/ocfs2/dlm/dlmcommon.h | 2 +- fs/ocfs2/dlm/dlmdomain.c | 2 +- fs/ocfs2/dlm/dlmrecovery.c | 4 +- fs/ocfs2/dlm/userdlm.c | 9 +++-- fs/ocfs2/journal.c | 12 +++--- fs/ocfs2/journal.h | 2 +- fs/ocfs2/kapi-default.h | 6 +++ fs/ocfs2/localalloc.c | 6 ++-- fs/ocfs2/localalloc.h | 2 +- fs/ocfs2/quota_global.c | 12 +++--- fs/ocfs2/super.c | 6 ++-- kapi-compat/include/workqueue.h | 12 +++++++ 24 files changed, 119 insertions(+), 77 deletions(-) create mode 100644 kapi-compat/include/workqueue.h diff --git a/Config.make.in b/Config.make.in index 4e008fb..cf292b6 100644 --- a/Config.make.in +++ b/Config.make.in @@ -57,6 +57,8 @@ MAKEBO_VERSION = @VERSION@ EXTRA_CFLAGS += @KAPI_COMPAT_CFLAGS@ +NO_DELAYED_WORK_STRUCT = @NO_DELAYED_WORK_STRUCT@ + OCFS_DEBUG = @OCFS_DEBUG@ diff --git a/Makefile b/Makefile index e335ac9..262bc49 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,8 @@ SUBDIRS = fs vendor LINUX_INCLUDE_FILES = -KAPI_COMPAT_FILES = +KAPI_COMPAT_FILES = \ + kapi-compat/include/workqueue.h PATCH_FILES = diff --git a/configure.in b/configure.in index ad06385..e4628a7 100644 --- a/configure.in +++ b/configure.in @@ -158,6 +158,12 @@ esac # Begin kapi_compat checks +NO_DELAYED_WORK_STRUCT= +OCFS2_CHECK_KERNEL([struct delayed_work in workqueue.h], workqueue.h, + , NO_DELAYED_WORK_STRUCT=workqueue.h, [^struct delayed_work]) +AC_SUBST(NO_DELAYED_WORK_STRUCT) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $NO_DELAYED_WORK_STRUCT" + # End kapi_compat checks diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile index 9ca23b4..4e4f49a 100644 --- a/fs/ocfs2/Makefile +++ b/fs/ocfs2/Makefile @@ -34,6 +34,10 @@ EXTRA_CFLAGS += -DCONFIG_OCFS2_DEBUG_MASKLOG EXTRA_CFLAGS += -DCONFIG_OCFS2_FS_STATS +ifdef NO_DELAYED_WORK_STRUCT +EXTRA_CFLAGS += -DNO_DELAYED_WORK_STRUCT +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes. diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index 38a42f5..a1cfe4b 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c @@ -6024,12 +6024,11 @@ int ocfs2_flush_truncate_log(struct ocfs2_super *osb) return status; } -static void ocfs2_truncate_log_worker(struct work_struct *work) +static void ocfs2_truncate_log_worker(kapi_work_struct_t *work) { int status; - struct ocfs2_super *osb = - container_of(work, struct ocfs2_super, - osb_truncate_log_wq.work); + struct ocfs2_super *osb = work_to_object(work, struct ocfs2_super, + osb_truncate_log_wq.work); mlog_entry_void(); @@ -6262,8 +6261,8 @@ int ocfs2_truncate_log_init(struct ocfs2_super *osb) /* ocfs2_truncate_log_shutdown keys on the existence of * osb->osb_tl_inode so we don't set any of the osb variables * until we're sure all is well. */ - INIT_DELAYED_WORK(&osb->osb_truncate_log_wq, - ocfs2_truncate_log_worker); + KAPI_INIT_DELAYED_WORK(&osb->osb_truncate_log_wq, + ocfs2_truncate_log_worker, osb); osb->osb_tl_bh = tl_bh; osb->osb_tl_inode = tl_inode; diff --git a/fs/ocfs2/cluster/Makefile b/fs/ocfs2/cluster/Makefile index fc5d3a0..c1f4f31 100644 --- a/fs/ocfs2/cluster/Makefile +++ b/fs/ocfs2/cluster/Makefile @@ -18,6 +18,10 @@ HEADERS = EXTRA_CFLAGS += -DCONFIG_OCFS2_DEBUG_MASKLOG +ifdef NO_DELAYED_WORK_STRUCT +EXTRA_CFLAGS += -DNO_DELAYED_WORK_STRUCT +endif + SOURCES += \ heartbeat.c \ masklog.c \ diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c index c452d11..68e9af5 100644 --- a/fs/ocfs2/cluster/heartbeat.c +++ b/fs/ocfs2/cluster/heartbeat.c @@ -162,11 +162,10 @@ struct o2hb_bio_wait_ctxt { int wc_error; }; -static void o2hb_write_timeout(struct work_struct *work) +static void o2hb_write_timeout(kapi_work_struct_t *work) { - struct o2hb_region *reg = - container_of(work, struct o2hb_region, - hr_write_timeout_work.work); + struct o2hb_region *reg = work_to_object(work, struct o2hb_region, + hr_write_timeout_work.work); mlog(ML_ERROR, "Heartbeat write timeout to device %s after %u " "milliseconds\n", reg->hr_dev_name, @@ -1400,7 +1399,8 @@ static ssize_t o2hb_region_dev_write(struct o2hb_region *reg, goto out; } - INIT_DELAYED_WORK(®->hr_write_timeout_work, o2hb_write_timeout); + KAPI_INIT_DELAYED_WORK(®->hr_write_timeout_work, o2hb_write_timeout, + reg); /* * A node is considered live after it has beat LIVE_THRESHOLD diff --git a/fs/ocfs2/cluster/quorum.c b/fs/ocfs2/cluster/quorum.c index bbacf7d..242622f 100644 --- a/fs/ocfs2/cluster/quorum.c +++ b/fs/ocfs2/cluster/quorum.c @@ -91,7 +91,7 @@ void o2quo_disk_timeout(void) o2quo_fence_self(); } -static void o2quo_make_decision(struct work_struct *work) +static void o2quo_make_decision(kapi_work_struct_t *work) { int quorum; int lowest_hb, lowest_reachable = 0, fence = 0; @@ -309,7 +309,7 @@ void o2quo_init(void) struct o2quo_state *qs = &o2quo_state; spin_lock_init(&qs->qs_lock); - INIT_WORK(&qs->qs_work, o2quo_make_decision); + KAPI_INIT_WORK(&qs->qs_work, o2quo_make_decision, qs); } void o2quo_exit(void) diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c index 334f231..4b8279e 100644 --- a/fs/ocfs2/cluster/tcp.c +++ b/fs/ocfs2/cluster/tcp.c @@ -133,11 +133,11 @@ static int o2net_sys_err_translations[O2NET_ERR_MAX] = [O2NET_ERR_DIED] = -EHOSTDOWN,}; /* can't quite avoid *all* internal declarations :/ */ -static void o2net_sc_connect_completed(struct work_struct *work); -static void o2net_rx_until_empty(struct work_struct *work); -static void o2net_shutdown_sc(struct work_struct *work); +static void o2net_sc_connect_completed(kapi_work_struct_t *work); +static void o2net_rx_until_empty(kapi_work_struct_t *work); +static void o2net_shutdown_sc(kapi_work_struct_t *work); static void o2net_listen_data_ready(struct sock *sk, int bytes); -static void o2net_sc_send_keep_req(struct work_struct *work); +static void o2net_sc_send_keep_req(kapi_work_struct_t *work); static void o2net_idle_timer(unsigned long data); static void o2net_sc_postpone_idle(struct o2net_sock_container *sc); static void o2net_sc_reset_idle_timer(struct o2net_sock_container *sc); @@ -386,10 +386,11 @@ static struct o2net_sock_container *sc_alloc(struct o2nm_node *node) o2nm_node_get(node); sc->sc_node = node; - INIT_WORK(&sc->sc_connect_work, o2net_sc_connect_completed); - INIT_WORK(&sc->sc_rx_work, o2net_rx_until_empty); - INIT_WORK(&sc->sc_shutdown_work, o2net_shutdown_sc); - INIT_DELAYED_WORK(&sc->sc_keepalive_work, o2net_sc_send_keep_req); + KAPI_INIT_WORK(&sc->sc_connect_work, o2net_sc_connect_completed, sc); + KAPI_INIT_WORK(&sc->sc_rx_work, o2net_rx_until_empty, sc); + KAPI_INIT_WORK(&sc->sc_shutdown_work, o2net_shutdown_sc, sc); + KAPI_INIT_DELAYED_WORK(&sc->sc_keepalive_work, o2net_sc_send_keep_req, + sc); init_timer(&sc->sc_idle_timeout); sc->sc_idle_timeout.function = o2net_idle_timer; @@ -662,11 +663,11 @@ static void o2net_ensure_shutdown(struct o2net_node *nn, * ourselves as state_change couldn't get the nn_lock and call set_nn_state * itself. */ -static void o2net_shutdown_sc(struct work_struct *work) +static void o2net_shutdown_sc(kapi_work_struct_t *work) { struct o2net_sock_container *sc = - container_of(work, struct o2net_sock_container, - sc_shutdown_work); + work_to_object(work, struct o2net_sock_container, + sc_shutdown_work); struct o2net_node *nn = o2net_nn_from_num(sc->sc_node->nd_num); sclog(sc, "shutting down\n"); @@ -1379,10 +1380,10 @@ out: /* this work func is triggerd by data ready. it reads until it can read no * more. it interprets 0, eof, as fatal. if data_ready hits while we're doing * our work the work struct will be marked and we'll be called again. */ -static void o2net_rx_until_empty(struct work_struct *work) +static void o2net_rx_until_empty(kapi_work_struct_t *work) { struct o2net_sock_container *sc = - container_of(work, struct o2net_sock_container, sc_rx_work); + work_to_object(work, struct o2net_sock_container, sc_rx_work); int ret; do { @@ -1439,11 +1440,11 @@ static void o2net_initialize_handshake(void) /* called when a connect completes and after a sock is accepted. the * rx path will see the response and mark the sc valid */ -static void o2net_sc_connect_completed(struct work_struct *work) +static void o2net_sc_connect_completed(kapi_work_struct_t *work) { struct o2net_sock_container *sc = - container_of(work, struct o2net_sock_container, - sc_connect_work); + work_to_object(work, struct o2net_sock_container, + sc_connect_work); mlog(ML_MSG, "sc sending handshake with ver %llu id %llx\n", (unsigned long long)O2NET_PROTOCOL_VERSION, @@ -1455,11 +1456,11 @@ static void o2net_sc_connect_completed(struct work_struct *work) } /* this is called as a work_struct func. */ -static void o2net_sc_send_keep_req(struct work_struct *work) +static void o2net_sc_send_keep_req(kapi_work_struct_t *work) { struct o2net_sock_container *sc = - container_of(work, struct o2net_sock_container, - sc_keepalive_work.work); + work_to_object(work, struct o2net_sock_container, + sc_keepalive_work.work); o2net_sendpage(sc, o2net_keep_req, sizeof(*o2net_keep_req)); sc_put(sc); @@ -1525,10 +1526,10 @@ static void o2net_sc_postpone_idle(struct o2net_sock_container *sc) * having a connect attempt fail, etc. This centralizes the logic which decides * if a connect attempt should be made or if we should give up and all future * transmit attempts should fail */ -static void o2net_start_connect(struct work_struct *work) +static void o2net_start_connect(kapi_work_struct_t *work) { struct o2net_node *nn = - container_of(work, struct o2net_node, nn_connect_work.work); + work_to_object(work, struct o2net_node, nn_connect_work.work); struct o2net_sock_container *sc = NULL; struct o2nm_node *node = NULL, *mynode = NULL; struct socket *sock = NULL; @@ -1642,10 +1643,11 @@ out: return; } -static void o2net_connect_expired(struct work_struct *work) +static void o2net_connect_expired(kapi_work_struct_t *work) { struct o2net_node *nn = - container_of(work, struct o2net_node, nn_connect_expired.work); + work_to_object(work, struct o2net_node, + nn_connect_expired.work); spin_lock(&nn->nn_lock); if (!nn->nn_sc_valid) { @@ -1660,10 +1662,10 @@ static void o2net_connect_expired(struct work_struct *work) spin_unlock(&nn->nn_lock); } -static void o2net_still_up(struct work_struct *work) +static void o2net_still_up(kapi_work_struct_t *work) { struct o2net_node *nn = - container_of(work, struct o2net_node, nn_still_up.work); + work_to_object(work, struct o2net_node, nn_still_up.work); o2quo_hb_still_up(o2net_num_from_nn(nn)); } @@ -1859,7 +1861,7 @@ out: return ret; } -static void o2net_accept_many(struct work_struct *work) +static void o2net_accept_many(kapi_work_struct_t *work) { struct socket *sock = o2net_listen_sock; while (o2net_accept_one(sock) == 0) @@ -1915,7 +1917,7 @@ static int o2net_open_listening_sock(__be32 addr, __be16 port) write_unlock_bh(&sock->sk->sk_callback_lock); o2net_listen_sock = sock; - INIT_WORK(&o2net_listen_work, o2net_accept_many); + KAPI_INIT_WORK(&o2net_listen_work, o2net_accept_many, sock); sock->sk->sk_reuse = 1; ret = sock->ops->bind(sock, (struct sockaddr *)&sin, sizeof(sin)); @@ -2039,10 +2041,11 @@ int o2net_init(void) atomic_set(&nn->nn_timeout, 0); spin_lock_init(&nn->nn_lock); - INIT_DELAYED_WORK(&nn->nn_connect_work, o2net_start_connect); - INIT_DELAYED_WORK(&nn->nn_connect_expired, - o2net_connect_expired); - INIT_DELAYED_WORK(&nn->nn_still_up, o2net_still_up); + KAPI_INIT_DELAYED_WORK(&nn->nn_connect_work, + o2net_start_connect, nn); + KAPI_INIT_DELAYED_WORK(&nn->nn_connect_expired, + o2net_connect_expired, nn); + KAPI_INIT_DELAYED_WORK(&nn->nn_still_up, o2net_still_up, nn); /* until we see hb from a node we'll return einval */ nn->nn_persistent_error = -ENOTCONN; init_waitqueue_head(&nn->nn_sc_wq); diff --git a/fs/ocfs2/dcache.c b/fs/ocfs2/dcache.c index b4957c7..8ad82bc 100644 --- a/fs/ocfs2/dcache.c +++ b/fs/ocfs2/dcache.c @@ -344,10 +344,10 @@ static void __ocfs2_drop_dl_inodes(struct ocfs2_super *osb, int drop_count) spin_unlock(&dentry_list_lock); } -void ocfs2_drop_dl_inodes(struct work_struct *work) +void ocfs2_drop_dl_inodes(kapi_work_struct_t *work) { - struct ocfs2_super *osb = container_of(work, struct ocfs2_super, - dentry_lock_work); + struct ocfs2_super *osb = work_to_object(work, struct ocfs2_super, + dentry_lock_work); __ocfs2_drop_dl_inodes(osb, DL_INODE_DROP_COUNT); /* diff --git a/fs/ocfs2/dcache.h b/fs/ocfs2/dcache.h index f5dd178..d13a087 100644 --- a/fs/ocfs2/dcache.h +++ b/fs/ocfs2/dcache.h @@ -54,7 +54,7 @@ extern spinlock_t dentry_list_lock; void ocfs2_dentry_lock_put(struct ocfs2_super *osb, struct ocfs2_dentry_lock *dl); -void ocfs2_drop_dl_inodes(struct work_struct *work); +void ocfs2_drop_dl_inodes(kapi_work_struct_t *work); void ocfs2_drop_all_dl_inodes(struct ocfs2_super *osb); struct dentry *ocfs2_find_local_alias(struct inode *inode, u64 parent_blkno, diff --git a/fs/ocfs2/dlm/Makefile b/fs/ocfs2/dlm/Makefile index 26cbf6c..44b6cc6 100644 --- a/fs/ocfs2/dlm/Makefile +++ b/fs/ocfs2/dlm/Makefile @@ -22,6 +22,10 @@ EXTRA_CFLAGS += -I$(OUR_TOPDIR)/fs/ocfs2 EXTRA_CFLAGS += -DCONFIG_OCFS2_DEBUG_MASKLOG +ifdef NO_DELAYED_WORK_STRUCT +EXTRA_CFLAGS += -DNO_DELAYED_WORK_STRUCT +endif + DLM_SOURCES += \ dlmast.c \ dlmconvert.c \ diff --git a/fs/ocfs2/dlm/dlmcommon.h b/fs/ocfs2/dlm/dlmcommon.h index 0102be3..a13292a 100644 --- a/fs/ocfs2/dlm/dlmcommon.h +++ b/fs/ocfs2/dlm/dlmcommon.h @@ -203,7 +203,7 @@ static inline struct hlist_head *dlm_master_hash(struct dlm_ctxt *dlm, * called functions that cannot be directly called from the * net message handlers for some reason, usually because * they need to send net messages of their own. */ -void dlm_dispatch_work(struct work_struct *work); +void dlm_dispatch_work(kapi_work_struct_t *work); struct dlm_lock_resource; struct dlm_work_item; diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c index 0334000..05a0350 100644 --- a/fs/ocfs2/dlm/dlmdomain.c +++ b/fs/ocfs2/dlm/dlmdomain.c @@ -1613,7 +1613,7 @@ static struct dlm_ctxt *dlm_alloc_ctxt(const char *domain, spin_lock_init(&dlm->work_lock); INIT_LIST_HEAD(&dlm->work_list); - INIT_WORK(&dlm->dispatched_work, dlm_dispatch_work); + KAPI_INIT_WORK(&dlm->dispatched_work, dlm_dispatch_work, dlm); kref_init(&dlm->dlm_refs); dlm->dlm_state = DLM_CTXT_NEW; diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c index d9fa3d2..2e16a38 100644 --- a/fs/ocfs2/dlm/dlmrecovery.c +++ b/fs/ocfs2/dlm/dlmrecovery.c @@ -152,10 +152,10 @@ static inline void dlm_reset_recovery(struct dlm_ctxt *dlm) } /* Worker function used during recovery. */ -void dlm_dispatch_work(struct work_struct *work) +void dlm_dispatch_work(kapi_work_struct_t *work) { struct dlm_ctxt *dlm = - container_of(work, struct dlm_ctxt, dispatched_work); + work_to_object(work, struct dlm_ctxt, dispatched_work); LIST_HEAD(tmp_list); struct dlm_work_item *item, *next; dlm_workfunc_t *workfunc; diff --git a/fs/ocfs2/dlm/userdlm.c b/fs/ocfs2/dlm/userdlm.c index 4cb1d3d..01a57c8 100644 --- a/fs/ocfs2/dlm/userdlm.c +++ b/fs/ocfs2/dlm/userdlm.c @@ -171,14 +171,15 @@ static inline void user_dlm_grab_inode_ref(struct user_lock_res *lockres) BUG(); } -static void user_dlm_unblock_lock(struct work_struct *work); +static void user_dlm_unblock_lock(kapi_work_struct_t *work); static void __user_dlm_queue_lockres(struct user_lock_res *lockres) { if (!(lockres->l_flags & USER_LOCK_QUEUED)) { user_dlm_grab_inode_ref(lockres); - INIT_WORK(&lockres->l_work, user_dlm_unblock_lock); + KAPI_INIT_WORK(&lockres->l_work, user_dlm_unblock_lock, + lockres); queue_work(user_dlm_worker, &lockres->l_work); lockres->l_flags |= USER_LOCK_QUEUED; @@ -278,11 +279,11 @@ static inline void user_dlm_drop_inode_ref(struct user_lock_res *lockres) iput(inode); } -static void user_dlm_unblock_lock(struct work_struct *work) +static void user_dlm_unblock_lock(kapi_work_struct_t *work) { int new_level, status; struct user_lock_res *lockres = - container_of(work, struct user_lock_res, l_work); + work_to_object(work, struct user_lock_res, l_work); struct dlm_ctxt *dlm = dlm_ctxt_from_user_lockres(lockres); mlog(0, "processing lockres %.*s\n", lockres->l_namelen, diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c index 54c16b6..67cc5a7 100644 --- a/fs/ocfs2/journal.c +++ b/fs/ocfs2/journal.c @@ -1189,11 +1189,11 @@ struct ocfs2_la_recovery_item { * NOTE: This function can and will sleep on recovery of other nodes * during cluster locking, just like any other ocfs2 process. */ -void ocfs2_complete_recovery(struct work_struct *work) +void ocfs2_complete_recovery(kapi_work_struct_t *work) { int ret; struct ocfs2_journal *journal = - container_of(work, struct ocfs2_journal, j_recovery_work); + work_to_object(work, struct ocfs2_journal, j_recovery_work); struct ocfs2_super *osb = journal->j_osb; struct ocfs2_dinode *la_dinode, *tl_dinode; struct ocfs2_la_recovery_item *item, *n; @@ -1926,13 +1926,13 @@ out: } /* Worker task that gets fired every ORPHAN_SCAN_SCHEDULE_TIMEOUT millsec */ -void ocfs2_orphan_scan_work(struct work_struct *work) +void ocfs2_orphan_scan_work(kapi_work_struct_t *work) { struct ocfs2_orphan_scan *os; struct ocfs2_super *osb; - os = container_of(work, struct ocfs2_orphan_scan, - os_orphan_scan_work.work); + os = work_to_object(work, struct ocfs2_orphan_scan, + os_orphan_scan_work.work); osb = os->os_osb; mutex_lock(&os->os_lock); @@ -1965,7 +1965,7 @@ void ocfs2_orphan_scan_init(struct ocfs2_super *osb) os->os_count = 0; os->os_seqno = 0; mutex_init(&os->os_lock); - INIT_DELAYED_WORK(&os->os_orphan_scan_work, ocfs2_orphan_scan_work); + KAPI_INIT_DELAYED_WORK(&os->os_orphan_scan_work, ocfs2_orphan_scan_work, os); } void ocfs2_orphan_scan_start(struct ocfs2_super *osb) diff --git a/fs/ocfs2/journal.h b/fs/ocfs2/journal.h index 3f74e09..321c857 100644 --- a/fs/ocfs2/journal.h +++ b/fs/ocfs2/journal.h @@ -159,7 +159,7 @@ void ocfs2_orphan_scan_start(struct ocfs2_super *osb); void ocfs2_orphan_scan_stop(struct ocfs2_super *osb); void ocfs2_orphan_scan_exit(struct ocfs2_super *osb); -void ocfs2_complete_recovery(struct work_struct *work); +void ocfs2_complete_recovery(kapi_work_struct_t *work); void ocfs2_wait_for_recovery(struct ocfs2_super *osb); int ocfs2_recovery_init(struct ocfs2_super *osb); diff --git a/fs/ocfs2/kapi-default.h b/fs/ocfs2/kapi-default.h index fcf3ac9..21e5e3a 100644 --- a/fs/ocfs2/kapi-default.h +++ b/fs/ocfs2/kapi-default.h @@ -22,5 +22,11 @@ #ifndef KAPI_DEFAULT_H #define KAPI_DEFAULT_H +#ifndef KAPI_INIT_WORK +typedef struct work_struct kapi_work_struct_t; +# define work_to_object(a, b, c) container_of(a, b, c) +# define KAPI_INIT_WORK(a, b, c) INIT_WORK(a, b) +# define KAPI_INIT_DELAYED_WORK(a, b, c) INIT_DELAYED_WORK(a, b) +#endif #endif diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c index ac10f83..83b22ca 100644 --- a/fs/ocfs2/localalloc.c +++ b/fs/ocfs2/localalloc.c @@ -93,11 +93,11 @@ void ocfs2_local_alloc_seen_free_bits(struct ocfs2_super *osb, spin_unlock(&osb->osb_lock); } -void ocfs2_la_enable_worker(struct work_struct *work) +void ocfs2_la_enable_worker(kapi_work_struct_t *work) { struct ocfs2_super *osb = - container_of(work, struct ocfs2_super, - la_enable_wq.work); + work_to_object(work, struct ocfs2_super, + la_enable_wq.work); spin_lock(&osb->osb_lock); osb->local_alloc_state = OCFS2_LA_ENABLED; spin_unlock(&osb->osb_lock); diff --git a/fs/ocfs2/localalloc.h b/fs/ocfs2/localalloc.h index ac5ea9f..3234d2a 100644 --- a/fs/ocfs2/localalloc.h +++ b/fs/ocfs2/localalloc.h @@ -54,6 +54,6 @@ int ocfs2_claim_local_alloc_bits(struct ocfs2_super *osb, void ocfs2_local_alloc_seen_free_bits(struct ocfs2_super *osb, unsigned int num_clusters); -void ocfs2_la_enable_worker(struct work_struct *work); +void ocfs2_la_enable_worker(kapi_work_struct_t *work); #endif /* OCFS2_LOCALALLOC_H */ diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c index b437dc0..0f319fb 100644 --- a/fs/ocfs2/quota_global.c +++ b/fs/ocfs2/quota_global.c @@ -28,7 +28,7 @@ static struct workqueue_struct *ocfs2_quota_wq = NULL; -static void qsync_work_fn(struct work_struct *work); +static void qsync_work_fn(kapi_work_struct_t *work); static void ocfs2_global_disk2memdqb(struct dquot *dquot, void *dp) { @@ -360,7 +360,7 @@ int ocfs2_global_read_info(struct super_block *sb, int type) oinfo->dqi_gi.dqi_usable_bs = sb->s_blocksize - OCFS2_QBLK_RESERVED_SPACE; oinfo->dqi_gi.dqi_qtree_depth = qtree_depth(&oinfo->dqi_gi); - INIT_DELAYED_WORK(&oinfo->dqi_sync_work, qsync_work_fn); + KAPI_INIT_DELAYED_WORK(&oinfo->dqi_sync_work, qsync_work_fn, oinfo); queue_delayed_work(ocfs2_quota_wq, &oinfo->dqi_sync_work, msecs_to_jiffies(oinfo->dqi_syncms)); @@ -653,11 +653,11 @@ out: return status; } -static void qsync_work_fn(struct work_struct *work) +static void qsync_work_fn(kapi_work_struct_t *work) { - struct ocfs2_mem_dqinfo *oinfo = container_of(work, - struct ocfs2_mem_dqinfo, - dqi_sync_work.work); + struct ocfs2_mem_dqinfo *oinfo = + work_to_object(work, struct ocfs2_mem_dqinfo, + dqi_sync_work.work); struct super_block *sb = oinfo->dqi_gqinode->i_sb; dquot_scan_active(sb, ocfs2_sync_dquot_helper, oinfo->dqi_type); diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index c0e48ae..5f19ff5 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c @@ -2027,7 +2027,7 @@ static int ocfs2_initialize_super(struct super_block *sb, osb->local_alloc_state = OCFS2_LA_UNUSED; osb->local_alloc_bh = NULL; - INIT_DELAYED_WORK(&osb->la_enable_wq, ocfs2_la_enable_worker); + KAPI_INIT_DELAYED_WORK(&osb->la_enable_wq, ocfs2_la_enable_worker, osb); init_waitqueue_head(&osb->osb_mount_event); @@ -2134,10 +2134,10 @@ static int ocfs2_initialize_super(struct super_block *sb, spin_lock_init(&journal->j_lock); journal->j_trans_id = (unsigned long) 1; INIT_LIST_HEAD(&journal->j_la_cleanups); - INIT_WORK(&journal->j_recovery_work, ocfs2_complete_recovery); + KAPI_INIT_WORK(&journal->j_recovery_work, ocfs2_complete_recovery, journal); journal->j_state = OCFS2_JOURNAL_FREE; - INIT_WORK(&osb->dentry_lock_work, ocfs2_drop_dl_inodes); + KAPI_INIT_WORK(&osb->dentry_lock_work, ocfs2_drop_dl_inodes, osb); osb->dentry_lock_list = NULL; /* get some pseudo constants for clustersize bits */ diff --git a/kapi-compat/include/workqueue.h b/kapi-compat/include/workqueue.h new file mode 100644 index 0000000..7f76278 --- /dev/null +++ b/kapi-compat/include/workqueue.h @@ -0,0 +1,12 @@ +#ifndef KAPI_WORKQUEUE_H +#define KAPI_WORKQUEUE_H + +#ifdef NO_DELAYED_WORK_STRUCT +# define delayed_work work_struct +typedef void kapi_work_struct_t; +# define work_to_object(a, b, c) (a) +# define KAPI_INIT_WORK(a, b, c) INIT_WORK(a, b, c) +# define KAPI_INIT_DELAYED_WORK(a, b, c) INIT_WORK(a, b, c) +#endif + +#endif -- 1.5.6.5 From Joel.Becker at oracle.com Wed Nov 11 14:57:07 2009 From: Joel.Becker at oracle.com (Joel Becker) Date: Wed, 11 Nov 2009 14:57:07 -0800 Subject: [Ocfs2-devel] [PATCH 02/10] ocfs2: Handle missing dlmconstants.h In-Reply-To: <4AFB1024.3050707@oracle.com> References: <1257818413-32014-1-git-send-email-sunil.mushran@oracle.com> <1257818413-32014-3-git-send-email-sunil.mushran@oracle.com> <20091111025956.GC17774@mail.oracle.com> <4AFB1024.3050707@oracle.com> Message-ID: <20091111225707.GG17774@mail.oracle.com> On Wed, Nov 11, 2009 at 11:27:32AM -0800, Sunil Mushran wrote: > Joel Becker wrote: > > Then maybe change this to > > > > #ifndef DLM_LOCK_NL > > # include > > #endif > > > > Not sure why we need to do this. Because if we are against mainline, we will not include the kapi-compat header. Then we have to include linux/dlmconstants.h. Or are you asking why do this instead of checking the NO_DLMCONSTANTS define? That works too. -EDONTCARE Joel -- "Sometimes one pays most for the things one gets for nothing." - Albert Einstein Joel Becker Principal Software Developer Oracle E-mail: joel.becker at oracle.com Phone: (650) 506-8127 From Joel.Becker at oracle.com Wed Nov 11 15:03:12 2009 From: Joel.Becker at oracle.com (Joel Becker) Date: Wed, 11 Nov 2009 15:03:12 -0800 Subject: [Ocfs2-devel] [PATCH 02/11] ocfs2: Handle workqueue changes In-Reply-To: <1257972298-15590-3-git-send-email-sunil.mushran@oracle.com> References: <1257972298-15590-1-git-send-email-sunil.mushran@oracle.com> <1257972298-15590-3-git-send-email-sunil.mushran@oracle.com> Message-ID: <20091111230311.GH17774@mail.oracle.com> On Wed, Nov 11, 2009 at 12:44:55PM -0800, Sunil Mushran wrote: > Mainline commit 52bad64d95bd89e08c49ec5a071fa6dcbe5a1a9c introduced > struct delayed_work to separate delayable and non-delayable work. In patches like this, the commit message should describe how we handled it. Here, we'd say: "we create initialization and access wrappers to handle the different APIs," or somethign like that. Joel -- Life's Little Instruction Book #24 "Drink champagne for no reason at all." Joel Becker Principal Software Developer Oracle E-mail: joel.becker at oracle.com Phone: (650) 506-8127 From Joel.Becker at oracle.com Wed Nov 11 15:04:31 2009 From: Joel.Becker at oracle.com (Joel Becker) Date: Wed, 11 Nov 2009 15:04:31 -0800 Subject: [Ocfs2-devel] [PATCH 08/11] ocfs2: Handle struct f_path in struct file In-Reply-To: <1257972298-15590-5-git-send-email-sunil.mushran@oracle.com> References: <1257972298-15590-1-git-send-email-sunil.mushran@oracle.com> <1257972298-15590-5-git-send-email-sunil.mushran@oracle.com> Message-ID: <20091111230431.GI17774@mail.oracle.com> On Wed, Nov 11, 2009 at 12:44:57PM -0800, Sunil Mushran wrote: > Mainline commit 0f7fc9e4d03987fe29f6dd4aa67e4c56eb7ecb05 added > struct path into struct file. Again, let's describe how we did it in the commit message. "We wrap access with the functions filp_dentry() and filp_mnt()". Something like that. It makes it clear what to look for and that filp_dentry() isn't a kernel API, it's our wrapper. Joel -- "In the long run...we'll all be dead." -Unknown Joel Becker Principal Software Developer Oracle E-mail: joel.becker at oracle.com Phone: (650) 506-8127 From Joel.Becker at oracle.com Wed Nov 11 15:06:12 2009 From: Joel.Becker at oracle.com (Joel Becker) Date: Wed, 11 Nov 2009 15:06:12 -0800 Subject: [Ocfs2-devel] [PATCH 11/11] ocfs2: Handle different f_version types In-Reply-To: <1257972298-15590-6-git-send-email-sunil.mushran@oracle.com> References: <1257972298-15590-1-git-send-email-sunil.mushran@oracle.com> <1257972298-15590-6-git-send-email-sunil.mushran@oracle.com> Message-ID: <20091111230612.GJ17774@mail.oracle.com> On Wed, Nov 11, 2009 at 12:44:58PM -0800, Sunil Mushran wrote: > Mainline commit 2b47c3611de05c585e2d81204f6c7e3e255a3461 changed type of > file->f_version from unsigned long to u64. ... We wrap f_version in a type called f_version_t so that functions don't have to care about the width of the type ... > This patch allows building with > kernels having either definition. Build fails if the type is something else. > > Signed-off-by: Sunil Mushran -- Bram's Law: The easier a piece of software is to write, the worse it's implemented in practice. Joel Becker Principal Software Developer Oracle E-mail: joel.becker at oracle.com Phone: (650) 506-8127 From sunil.mushran at oracle.com Wed Nov 11 19:39:57 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Wed, 11 Nov 2009 19:39:57 -0800 Subject: [Ocfs2-devel] ocfs2 1.6 - fourth set Message-ID: <1257997205-18055-1-git-send-email-sunil.mushran@oracle.com> The next set. The previous 3 sets have been pushed to the git repo. From sunil.mushran at oracle.com Wed Nov 11 19:39:59 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Wed, 11 Nov 2009 19:39:59 -0800 Subject: [Ocfs2-devel] [PATCH 2/8] ocfs2: Handle missing vectorized fileops aio_read() and aio_write() In-Reply-To: <1257997205-18055-1-git-send-email-sunil.mushran@oracle.com> References: <1257997205-18055-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1257997205-18055-3-git-send-email-sunil.mushran@oracle.com> Mainline commit 027445c37282bc1ed26add45e573ad2d3e4860a5 vectorized fileops aio_read() and aio_write(). Patch provides support for the non-vectorized fileops (in EL5) by hand crafting the iovec with the provided buf and buflen. Signed-off-by: Sunil Mushran --- Config.make.in | 1 + Makefile | 3 +- configure.in | 6 ++++ fs/ocfs2/Makefile | 4 +++ fs/ocfs2/file.c | 6 ++-- fs/ocfs2/kapi-default.h | 7 +++++ kapi-compat/include/aiovec.h | 57 ++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 80 insertions(+), 4 deletions(-) create mode 100644 kapi-compat/include/aiovec.h diff --git a/Config.make.in b/Config.make.in index 2e5ff54..d129c64 100644 --- a/Config.make.in +++ b/Config.make.in @@ -70,6 +70,7 @@ EXPORTOP_IS_NOT_CONST = @EXPORTOP_IS_NOT_CONST@ MATCHTABLE_IS_NOT_CONST = @MATCHTABLE_IS_NOT_CONST@ VMOP_IS_NOT_CONST = @VMOP_IS_NOT_CONST@ SEQOP_IS_NOT_CONST = @SEQOP_IS_NOT_CONST@ +NO_VECTORIZED_AIO = @NO_VECTORIZED_AIO@ OCFS_DEBUG = @OCFS_DEBUG@ diff --git a/Makefile b/Makefile index 6676daf..140b9cd 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/fpath.h \ kapi-compat/include/ushortmax.h \ kapi-compat/include/fversion.h \ - kapi-compat/include/relatime.h + kapi-compat/include/relatime.h \ + kapi-compat/include/aiovec.h PATCH_FILES = diff --git a/configure.in b/configure.in index 07325c3..0b98e28 100644 --- a/configure.in +++ b/configure.in @@ -276,6 +276,12 @@ OCFS2_CHECK_KERNEL([MNT_RELATIME in mount.h], mount.h, , relatime_compat_header=relatime.h, [^#define MNT_RELATIME]) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $relatime_compat_header" +NO_VECTORIZED_AIO= +OCFS2_CHECK_KERNEL([aio_read() in struct file_operations using iovec in fs.h], fs.h, + , NO_VECTORIZED_AIO=aiovec.h, [ssize_t (\*aio_read) (struct kiocb \*, const struct iovec \*, unsigned long, loff_t);]) +AC_SUBST(NO_VECTORIZED_AIO) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $NO_VECTORIZED_AIO" + # End kapi_compat checks diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile index 1b19e4c..df389bc 100644 --- a/fs/ocfs2/Makefile +++ b/fs/ocfs2/Makefile @@ -84,6 +84,10 @@ ifdef VMOP_IS_NOT_CONST EXTRA_CFLAGS += -DVMOP_IS_NOT_CONST endif +ifdef NO_VECTORIZED_AIO +CFLAGS_file.o += -DNO_VECTORIZED_AIO +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes. diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 7bac90d..f5e8681 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c @@ -1892,7 +1892,7 @@ out: return ret; } -static ssize_t ocfs2_file_aio_write(struct kiocb *iocb, +static ssize_t __ocfs2_file_aio_write(struct kiocb *iocb, const struct iovec *iov, unsigned long nr_segs, loff_t pos) @@ -2168,7 +2168,7 @@ bail: return ret; } -static ssize_t ocfs2_file_aio_read(struct kiocb *iocb, +static ssize_t __ocfs2_file_aio_read(struct kiocb *iocb, const struct iovec *iov, unsigned long nr_segs, loff_t pos) @@ -2222,7 +2222,7 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb, } ocfs2_inode_unlock(inode, lock_level); - ret = generic_file_aio_read(iocb, iov, nr_segs, iocb->ki_pos); + ret = kapi_generic_file_aio_read(iocb, iov, nr_segs, iocb->ki_pos); if (ret == -EINVAL) mlog(0, "generic_file_aio_read returned -EINVAL\n"); diff --git a/fs/ocfs2/kapi-default.h b/fs/ocfs2/kapi-default.h index 3f04924..d068aaf 100644 --- a/fs/ocfs2/kapi-default.h +++ b/fs/ocfs2/kapi-default.h @@ -39,4 +39,11 @@ typedef struct work_struct kapi_work_struct_t; typedef u64 f_version_t; #endif +#ifndef kapi_generic_file_aio_read +# define kapi_generic_file_aio_read(a, b, c, d) \ + generic_file_aio_read(a, b, c, d) +# define ocfs2_file_aio_read __ocfs2_file_aio_read +# define ocfs2_file_aio_write __ocfs2_file_aio_write +#endif + #endif diff --git a/kapi-compat/include/aiovec.h b/kapi-compat/include/aiovec.h new file mode 100644 index 0000000..0c4c312 --- /dev/null +++ b/kapi-compat/include/aiovec.h @@ -0,0 +1,57 @@ +#ifndef KAPI_AIOVEC_H +#define KAPI_AIOVEC_H + +#ifdef NO_VECTORIZED_AIO + +#include +#include + +static ssize_t kapi_generic_file_aio_read(struct kiocb *iocb, + const struct iovec *iov, + unsigned long nr_segs, + loff_t pos) +{ + BUG_ON(nr_segs != 1); + return generic_file_aio_read(iocb, iov->iov_base, iov->iov_len, pos); +} + +static ssize_t __ocfs2_file_aio_read(struct kiocb *iocb, + const struct iovec *iov, + unsigned long nr_segs, + loff_t pos); + +static ssize_t ocfs2_file_aio_read(struct kiocb *iocb, + char __user *buf, + size_t buflen, + loff_t pos) +{ + struct iovec iov_local = { .iov_base = (void __user *)buf, + .iov_len = buflen }; + const struct iovec *iov = &iov_local; + unsigned long nr_segs = 1; + + return __ocfs2_file_aio_read(iocb, iov, nr_segs, pos); +} + +static ssize_t __ocfs2_file_aio_write(struct kiocb *iocb, + const struct iovec *iov, + unsigned long nr_segs, + loff_t pos); + +static ssize_t ocfs2_file_aio_write(struct kiocb *iocb, + const char __user *buf, + size_t buflen, + loff_t pos) +{ + struct iovec iov_local = { .iov_base = (void __user *)buf, + .iov_len = buflen }; + const struct iovec *iov = &iov_local; + unsigned long nr_segs = 1; + + iocb->ki_left = buflen; + return __ocfs2_file_aio_write(iocb, iov, nr_segs, pos); +} + +#endif + +#endif -- 1.5.6.5 From sunil.mushran at oracle.com Wed Nov 11 19:40:04 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Wed, 11 Nov 2009 19:40:04 -0800 Subject: [Ocfs2-devel] [PATCH 7/8] ocfs2: Handle older prototype of register_sysctl_table() In-Reply-To: <1257997205-18055-1-git-send-email-sunil.mushran@oracle.com> References: <1257997205-18055-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1257997205-18055-8-git-send-email-sunil.mushran@oracle.com> Mainline commit 0b4d414714f0d2f922d39424b0c5c82ad900a381 removed the insert_at_head argument from register_sysctl_table(). Patch allows building with older kernels. Signed-off-by: Sunil Mushran --- Makefile | 3 ++- configure.in | 5 +++++ fs/ocfs2/kapi-default.h | 4 ++++ fs/ocfs2/stackglue.c | 2 +- kapi-compat/include/register_sysctl.h | 6 ++++++ 5 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 kapi-compat/include/register_sysctl.h diff --git a/Makefile b/Makefile index 01b0033..a8d30d0 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/aiovec.h \ kapi-compat/include/mandatory_lock.h \ kapi-compat/include/fsuid.h \ - kapi-compat/include/umh_wait.h + kapi-compat/include/umh_wait.h \ + kapi-compat/include/register_sysctl.h PATCH_FILES = diff --git a/configure.in b/configure.in index 9cfdbe3..cc0574a 100644 --- a/configure.in +++ b/configure.in @@ -318,6 +318,11 @@ OCFS2_CHECK_KERNEL([enum umh_wait in kmod.h], kmod.h, , kmod_compat_header=umh_wait.h, [enum umh_wait {]) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $kmod_compat_header" +old_register_sysctl= +OCFS2_CHECK_KERNEL([register_sysctl_table() has one arg in sysctl.h], sysctl.h, + , old_register_sysctl=register_sysctl.h, [^struct ctl_table_header \*register_sysctl_table(struct ctl_table \* table);]) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $old_register_sysctl" + # End kapi_compat checks # using -include has two advantages: diff --git a/fs/ocfs2/kapi-default.h b/fs/ocfs2/kapi-default.h index d068aaf..7489a19 100644 --- a/fs/ocfs2/kapi-default.h +++ b/fs/ocfs2/kapi-default.h @@ -46,4 +46,8 @@ typedef u64 f_version_t; # define ocfs2_file_aio_write __ocfs2_file_aio_write #endif +#ifndef kapi_register_sysctl_table +# define kapi_register_sysctl_table(a) register_sysctl_table(a) +#endif + #endif diff --git a/fs/ocfs2/stackglue.c b/fs/ocfs2/stackglue.c index 3f2f1c4..b4c85be 100644 --- a/fs/ocfs2/stackglue.c +++ b/fs/ocfs2/stackglue.c @@ -678,7 +678,7 @@ static int __init ocfs2_stack_glue_init(void) { strcpy(cluster_stack_name, OCFS2_STACK_PLUGIN_O2CB); - ocfs2_table_header = register_sysctl_table(ocfs2_root_table); + ocfs2_table_header = kapi_register_sysctl_table(ocfs2_root_table); if (!ocfs2_table_header) { printk(KERN_ERR "ocfs2 stack glue: unable to register sysctl\n"); diff --git a/kapi-compat/include/register_sysctl.h b/kapi-compat/include/register_sysctl.h new file mode 100644 index 0000000..15d9068 --- /dev/null +++ b/kapi-compat/include/register_sysctl.h @@ -0,0 +1,6 @@ +#ifndef KAPI_REGISTER_SYSCTL_H +#define KAPI_REGISTER_SYSCTL_H + +#define kapi_register_sysctl_table(a) register_sysctl_table(a, 0) + +#endif -- 1.5.6.5 From sunil.mushran at oracle.com Wed Nov 11 19:40:00 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Wed, 11 Nov 2009 19:40:00 -0800 Subject: [Ocfs2-devel] [PATCH 3/8] ocfs2: Handle older prototype of iops->permission() In-Reply-To: <1257997205-18055-1-git-send-email-sunil.mushran@oracle.com> References: <1257997205-18055-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1257997205-18055-4-git-send-email-sunil.mushran@oracle.com> Mainline commit e6305c43eda10ebfd2ad9e35d6e172ccc7bb3695 changed the prototype of iops->permission() by dropping the last argument. - int (*permission) (struct inode *, int, struct nameidata *); + int (*permission) (struct inode *, int); Patch allows building with kernels having the older prototype. Signed-off-by: Sunil Mushran --- Config.make.in | 1 + configure.in | 13 +++++++++++++ fs/ocfs2/Makefile | 4 ++++ fs/ocfs2/file.c | 4 ++++ fs/ocfs2/file.h | 4 ++++ 5 files changed, 26 insertions(+), 0 deletions(-) diff --git a/Config.make.in b/Config.make.in index d129c64..a19d096 100644 --- a/Config.make.in +++ b/Config.make.in @@ -71,6 +71,7 @@ MATCHTABLE_IS_NOT_CONST = @MATCHTABLE_IS_NOT_CONST@ VMOP_IS_NOT_CONST = @VMOP_IS_NOT_CONST@ SEQOP_IS_NOT_CONST = @SEQOP_IS_NOT_CONST@ NO_VECTORIZED_AIO = @NO_VECTORIZED_AIO@ +OLD_PERMISSION = @OLD_PERMISSION@ OCFS_DEBUG = @OCFS_DEBUG@ diff --git a/configure.in b/configure.in index 0b98e28..a1c4255 100644 --- a/configure.in +++ b/configure.in @@ -282,6 +282,19 @@ OCFS2_CHECK_KERNEL([aio_read() in struct file_operations using iovec in fs.h], f AC_SUBST(NO_VECTORIZED_AIO) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $NO_VECTORIZED_AIO" +OLD_PERSMISSION= +OCFS2_CHECK_KERNEL([ older prototype of iops->permission() in fs.h], fs.h, +OLD_PERSMISSION=yes, , [int (\*permission) (struct inode \*, int, struct nameidata \*);]) +AC_SUBST(OLD_PERSMISSION) +if test "x$OLD_PERSMISSION" = "x" ; then + new_permission= + OCFS2_CHECK_KERNEL([ newer prototype of iops->permission() in fs.h], fs.h, + new_permission=yes, , [int (\*permission) (struct inode \*, int);]) + if test "x$new_permission" = "x" ; then + AC_MSG_ERROR(Cannot build with kernel as the prototype of iops->permission is not recognized) + fi +fi + # End kapi_compat checks diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile index df389bc..32d864d 100644 --- a/fs/ocfs2/Makefile +++ b/fs/ocfs2/Makefile @@ -88,6 +88,10 @@ ifdef NO_VECTORIZED_AIO CFLAGS_file.o += -DNO_VECTORIZED_AIO endif +ifdef OLD_PERMISSION +EXTRA_CFLAGS += -DOLD_PERMISSION +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes. diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index f5e8681..4c12c2d 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c @@ -1138,7 +1138,11 @@ bail: return err; } +#ifdef OLD_PERMISSION +int ocfs2_permission(struct inode *inode, int mask, struct nameidata *nd) +#else int ocfs2_permission(struct inode *inode, int mask) +#endif { int ret; diff --git a/fs/ocfs2/file.h b/fs/ocfs2/file.h index da85393..845ea30 100644 --- a/fs/ocfs2/file.h +++ b/fs/ocfs2/file.h @@ -64,7 +64,11 @@ int ocfs2_extend_no_holes(struct inode *inode, u64 new_i_size, int ocfs2_setattr(struct dentry *dentry, struct iattr *attr); int ocfs2_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat); +#ifdef OLD_PERMISSION +int ocfs2_permission(struct inode *inode, int mask, struct nameidata *nd); +#else int ocfs2_permission(struct inode *inode, int mask); +#endif int ocfs2_should_update_atime(struct inode *inode, struct vfsmount *vfsmnt); -- 1.5.6.5 From sunil.mushran at oracle.com Wed Nov 11 19:40:05 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Wed, 11 Nov 2009 19:40:05 -0800 Subject: [Ocfs2-devel] [PATCH 8/8] ocfs2: Handle missing enum value FS_OCFS2 In-Reply-To: <1257997205-18055-1-git-send-email-sunil.mushran@oracle.com> References: <1257997205-18055-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1257997205-18055-9-git-send-email-sunil.mushran@oracle.com> Mainline commit 0e03036c97b70b2602f7dedaa3a223ed7563c2c9 added enum FS_OCFS2. Signed-off-by: Sunil Mushran --- Makefile | 3 ++- configure.in | 5 +++++ kapi-compat/include/sysctl.h | 9 +++++++++ 3 files changed, 16 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/sysctl.h diff --git a/Makefile b/Makefile index a8d30d0..adaf9fb 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/mandatory_lock.h \ kapi-compat/include/fsuid.h \ kapi-compat/include/umh_wait.h \ - kapi-compat/include/register_sysctl.h + kapi-compat/include/register_sysctl.h \ + kapi-compat/include/sysctl.h PATCH_FILES = diff --git a/configure.in b/configure.in index cc0574a..b662f88 100644 --- a/configure.in +++ b/configure.in @@ -323,6 +323,11 @@ OCFS2_CHECK_KERNEL([register_sysctl_table() has one arg in sysctl.h], sysctl.h, , old_register_sysctl=register_sysctl.h, [^struct ctl_table_header \*register_sysctl_table(struct ctl_table \* table);]) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $old_register_sysctl" +sysctl_compat_header= +OCFS2_CHECK_KERNEL([enum FS_OCFS2 in sysctl.h], sysctl.h, + , sysctl_compat_header=sysctl.h, [FS_OCFS2=]) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $sysctl_compat_header" + # End kapi_compat checks # using -include has two advantages: diff --git a/kapi-compat/include/sysctl.h b/kapi-compat/include/sysctl.h new file mode 100644 index 0000000..73ed0a7 --- /dev/null +++ b/kapi-compat/include/sysctl.h @@ -0,0 +1,9 @@ +#ifndef KAPI_SYSCTL_H +#define KAPI_SYSCTL_H + +/* CTL_FS names: */ +enum { + FS_OCFS2=988, /* ocfs2 */ +}; + +#endif -- 1.5.6.5 From sunil.mushran at oracle.com Wed Nov 11 19:40:02 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Wed, 11 Nov 2009 19:40:02 -0800 Subject: [Ocfs2-devel] [PATCH 5/8] ocfs2: Handle missing helper current_fsuid() In-Reply-To: <1257997205-18055-1-git-send-email-sunil.mushran@oracle.com> References: <1257997205-18055-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1257997205-18055-6-git-send-email-sunil.mushran@oracle.com> Mainline commit 86a264abe542cfececb4df129bc45a0338d8cdb9 added helper current_fsuid(). An earlier commit grouped security credentials in struct task in struct cred. The patch ensures that if the above helper is not found, that struct cred is missing. If not, build fails. Signed-off-by: Sunil Mushran --- Makefile | 3 ++- configure.in | 13 +++++++++++++ kapi-compat/include/fsuid.h | 7 +++++++ 3 files changed, 22 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/fsuid.h diff --git a/Makefile b/Makefile index b9d5c5f..46c7218 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/fversion.h \ kapi-compat/include/relatime.h \ kapi-compat/include/aiovec.h \ - kapi-compat/include/mandatory_lock.h + kapi-compat/include/mandatory_lock.h \ + kapi-compat/include/fsuid.h PATCH_FILES = diff --git a/configure.in b/configure.in index d0d1d18..3548225 100644 --- a/configure.in +++ b/configure.in @@ -300,6 +300,19 @@ OCFS2_CHECK_KERNEL([mandatory_lock() in fs.h], fs.h, , mandatory_lock_header=mandatory_lock.h, [^static inline int mandatory_lock(]) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $mandatory_lock_header" +no_current_fsuid= +OCFS2_CHECK_KERNEL([current_fsuid() in cred.h], cred.h, + , no_current_fsuid=fsuid.h, [#define current_fsuid()]) +if test "x$no_current_fsuid" = "xfsuid.h" ; then + fsuid_in_task= + OCFS2_CHECK_KERNEL([ fsuid in struct task in sched.h], sched.h, + fsuid_in_task=yes, , [uid_t uid,euid,suid,fsuid;]) + if test "x$fsuid_in_task" = "x" ; then + AC_MSG_ERROR(Cannot build with kernel that is missing fsuid and struct cred in struct task) + fi +fi +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $no_current_fsuid" + # End kapi_compat checks # using -include has two advantages: diff --git a/kapi-compat/include/fsuid.h b/kapi-compat/include/fsuid.h new file mode 100644 index 0000000..08d0915 --- /dev/null +++ b/kapi-compat/include/fsuid.h @@ -0,0 +1,7 @@ +#ifndef KAPI_FSUID_H +#define KAPI_FSUID_H + +#define current_fsuid() (current->fsuid) +#define current_fsgid() (current->fsgid) + +#endif -- 1.5.6.5 From sunil.mushran at oracle.com Wed Nov 11 19:40:03 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Wed, 11 Nov 2009 19:40:03 -0800 Subject: [Ocfs2-devel] [PATCH 6/8] ocfs2: Handle missing enum umh_wait In-Reply-To: <1257997205-18055-1-git-send-email-sunil.mushran@oracle.com> References: <1257997205-18055-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1257997205-18055-7-git-send-email-sunil.mushran@oracle.com> Mainline commit 86313c488a6848b7ec2ba04e74f25f79dd32a0b7 added enum umh_wait in kmod.h. Signed-off-by: Sunil Mushran --- Makefile | 3 ++- configure.in | 5 +++++ kapi-compat/include/umh_wait.h | 10 ++++++++++ 3 files changed, 17 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/umh_wait.h diff --git a/Makefile b/Makefile index 46c7218..01b0033 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/relatime.h \ kapi-compat/include/aiovec.h \ kapi-compat/include/mandatory_lock.h \ - kapi-compat/include/fsuid.h + kapi-compat/include/fsuid.h \ + kapi-compat/include/umh_wait.h PATCH_FILES = diff --git a/configure.in b/configure.in index 3548225..9cfdbe3 100644 --- a/configure.in +++ b/configure.in @@ -313,6 +313,11 @@ if test "x$no_current_fsuid" = "xfsuid.h" ; then fi KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $no_current_fsuid" +kmod_compat_header= +OCFS2_CHECK_KERNEL([enum umh_wait in kmod.h], kmod.h, + , kmod_compat_header=umh_wait.h, [enum umh_wait {]) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $kmod_compat_header" + # End kapi_compat checks # using -include has two advantages: diff --git a/kapi-compat/include/umh_wait.h b/kapi-compat/include/umh_wait.h new file mode 100644 index 0000000..42a082b --- /dev/null +++ b/kapi-compat/include/umh_wait.h @@ -0,0 +1,10 @@ +#ifndef KAPI_KMOD_H +#define KAPI_KMOD_H + +enum umh_wait { + UMH_NO_WAIT = -1, /* don't wait at all */ + UMH_WAIT_EXEC = 0, /* wait for the exec, but not the process */ + UMH_WAIT_PROC = 1, /* wait for the process to complete */ +}; + +#endif -- 1.5.6.5 From sunil.mushran at oracle.com Wed Nov 11 19:40:01 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Wed, 11 Nov 2009 19:40:01 -0800 Subject: [Ocfs2-devel] [PATCH 4/8] ocfs2: Handle missing helper mandatory_lock() In-Reply-To: <1257997205-18055-1-git-send-email-sunil.mushran@oracle.com> References: <1257997205-18055-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1257997205-18055-5-git-send-email-sunil.mushran@oracle.com> Mainline commit a16877ca9cec211708a161057a7cbfbf2cbc3a53 added helper mandatory_lock(). Signed-off-by: Sunil Mushran --- Makefile | 3 ++- configure.in | 4 ++++ kapi-compat/include/mandatory_lock.h | 25 +++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/mandatory_lock.h diff --git a/Makefile b/Makefile index 140b9cd..b9d5c5f 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/ushortmax.h \ kapi-compat/include/fversion.h \ kapi-compat/include/relatime.h \ - kapi-compat/include/aiovec.h + kapi-compat/include/aiovec.h \ + kapi-compat/include/mandatory_lock.h PATCH_FILES = diff --git a/configure.in b/configure.in index a1c4255..d0d1d18 100644 --- a/configure.in +++ b/configure.in @@ -295,6 +295,10 @@ if test "x$OLD_PERSMISSION" = "x" ; then fi fi +mandatory_lock_header= +OCFS2_CHECK_KERNEL([mandatory_lock() in fs.h], fs.h, + , mandatory_lock_header=mandatory_lock.h, [^static inline int mandatory_lock(]) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $mandatory_lock_header" # End kapi_compat checks diff --git a/kapi-compat/include/mandatory_lock.h b/kapi-compat/include/mandatory_lock.h new file mode 100644 index 0000000..9c9f937 --- /dev/null +++ b/kapi-compat/include/mandatory_lock.h @@ -0,0 +1,25 @@ +#ifndef KAPI_MANDATORY_LOCK_H +#define KAPI_MANDATORY_LOCK_H + +#include +/* + * Candidates for mandatory locking have the setgid bit set + * but no group execute bit - an otherwise meaningless combination. + */ + +static inline int __mandatory_lock(struct inode *ino) +{ + return (ino->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID; +} + +/* + * ... and these candidates should be on MS_MANDLOCK mounted fs, + * otherwise these will be advisory locks + */ + +static inline int mandatory_lock(struct inode *ino) +{ + return IS_MANDLOCK(ino) && __mandatory_lock(ino); +} + +#endif /* KAPI_MANDATORY_LOCK_H */ -- 1.5.6.5 From sunil.mushran at oracle.com Wed Nov 11 19:39:58 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Wed, 11 Nov 2009 19:39:58 -0800 Subject: [Ocfs2-devel] [PATCH 1/8] ocfs2: Handle missing macro MNT_RELATIME In-Reply-To: <1257997205-18055-1-git-send-email-sunil.mushran@oracle.com> References: <1257997205-18055-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1257997205-18055-2-git-send-email-sunil.mushran@oracle.com> Mainline commit 47ae32d6a54955a041cdc30b06d0bb16e75f68d5 added macro MNT_RELATIME. It should be noted that the functionality will not be available on EL5 as the vfs support is missing. TODO: This feature needs to be enabled by parsing the realtime mount option in ocfs2 itself. Signed-off-by: Sunil Mushran --- Makefile | 3 ++- configure.in | 5 +++++ kapi-compat/include/relatime.h | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/relatime.h diff --git a/Makefile b/Makefile index 06ddabf..6676daf 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/sync_mapping.h \ kapi-compat/include/fpath.h \ kapi-compat/include/ushortmax.h \ - kapi-compat/include/fversion.h + kapi-compat/include/fversion.h \ + kapi-compat/include/relatime.h PATCH_FILES = diff --git a/configure.in b/configure.in index 26b9f80..07325c3 100644 --- a/configure.in +++ b/configure.in @@ -271,6 +271,11 @@ OCFS2_CHECK_KERNEL([seq_open() has const struct seq_operations * in seq_file.h], , SEQOP_IS_NOT_CONST=yes, [int seq_open(struct file \*, const struct seq_operations \*);]) AC_SUBST(SEQOP_IS_NOT_CONST) +relatime_compat_header="" +OCFS2_CHECK_KERNEL([MNT_RELATIME in mount.h], mount.h, + , relatime_compat_header=relatime.h, [^#define MNT_RELATIME]) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $relatime_compat_header" + # End kapi_compat checks diff --git a/kapi-compat/include/relatime.h b/kapi-compat/include/relatime.h new file mode 100644 index 0000000..34c5d38 --- /dev/null +++ b/kapi-compat/include/relatime.h @@ -0,0 +1,6 @@ +#ifndef KAPI_RELATIME_H +#define KAPI_RELATIME_H + +#define MNT_RELATIME 0x20 + +#endif -- 1.5.6.5 From roel.kluin at gmail.com Wed Nov 11 13:45:10 2009 From: roel.kluin at gmail.com (Roel Kluin) Date: Wed, 11 Nov 2009 22:45:10 +0100 Subject: [Ocfs2-devel] [PATCH] ocfs2: Should error return be negative? Message-ID: <4AFB3066.4080102@gmail.com> Return a negative error value instead of a positive Signed-off-by: Roel Kluin --- fs/ocfs2/dlm/dlmrecovery.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) The return of a positive error is unusual for oracle: [roel at zoinx linux-git]$ git grep -n -E "return E[[:upper:]]*;" -- fs/ocfs2/ | wc -l 1 [roel at zoinx linux-git]$ git grep -n -E "return -E[[:upper:]]*;" -- fs/ocfs2/ | wc -l 251 is this maybe required? diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c index d9fa3d2..0a8a6a4 100644 --- a/fs/ocfs2/dlm/dlmrecovery.c +++ b/fs/ocfs2/dlm/dlmrecovery.c @@ -2639,7 +2639,7 @@ int dlm_begin_reco_handler(struct o2net_msg *msg, u32 len, void *data, dlm->name, br->node_idx, br->dead_node, dlm->reco.dead_node, dlm->reco.new_master); spin_unlock(&dlm->spinlock); - return EAGAIN; + return -EAGAIN; } spin_unlock(&dlm->spinlock); From mingo at elte.hu Thu Nov 12 00:10:43 2009 From: mingo at elte.hu (Ingo Molnar) Date: Thu, 12 Nov 2009 09:10:43 +0100 Subject: [Ocfs2-devel] [patch] Fix: 'return -ENOMEM' instead of 'return ENOMEM' In-Reply-To: <20091111134730.a0da9e38.akpm@linux-foundation.org> References: <4AFB2C0B.50605@gmail.com> <20091111134730.a0da9e38.akpm@linux-foundation.org> Message-ID: <20091112081043.GA25345@elte.hu> * Andrew Morton wrote: > > @@ -3730,7 +3730,7 @@ tracing_stats_read(struct file *filp, char __user *ubuf, > > > > s = kmalloc(sizeof(*s), GFP_KERNEL); > > if (!s) > > - return ENOMEM; > > + return -ENOMEM; > > > > trace_seq_init(s); > > > > lol, there we go again. > > Andy, can we have a checkpatch rule please? Note, that will upset creative uses of error codes i guess, such as fs/xfs/. But yeah, +1 from me too. Ob'post'mortem - looked for similar patterns in the kernel and there's quite a few bugs there: include/net/inet_hashtables.h: return ENOMEM; # bug drivers/scsi/aic7xxx/aic7xxx_osm.c: return ENOMEM; # works but weird drivers/scsi/cxgb3i/cxgb3i_offload.c: return ENOMEM; # works but weird fs/ocfs2/dlm/dlmrecovery.c: return EAGAIN; # bug drivers/block/cciss_scsi.c: return ENXIO; # works but weird drivers/gpu/drm/radeon/radeon_irq.c: return EINVAL; # bug drivers/gpu/drm/radeon/radeon_irq.c: return EINVAL; # bug drivers/isdn/hardware/mISDN/hfcmulti.c: return EINVAL; # bug 5 out of 8 places look buggy - i.e. more than 60% - a checkpatch warning would avoid real bugs here. (even ignoring the cleanliness effects of using proper error propagation) Cc:-ed affected maintainers. The rightmost column are my observations. Below is the patch fixing these. Ingo Signed-off-by: Ingo Molnar --- drivers/gpu/drm/radeon/radeon_irq.c | 4 ++-- drivers/isdn/hardware/mISDN/hfcmulti.c | 2 +- fs/ocfs2/dlm/dlmrecovery.c | 2 +- include/net/inet_hashtables.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_irq.c b/drivers/gpu/drm/radeon/radeon_irq.c index b79ecc4..fbbc0a1 100644 --- a/drivers/gpu/drm/radeon/radeon_irq.c +++ b/drivers/gpu/drm/radeon/radeon_irq.c @@ -76,7 +76,7 @@ int radeon_enable_vblank(struct drm_device *dev, int crtc) default: DRM_ERROR("tried to enable vblank on non-existent crtc %d\n", crtc); - return EINVAL; + return -EINVAL; } } else { switch (crtc) { @@ -89,7 +89,7 @@ int radeon_enable_vblank(struct drm_device *dev, int crtc) default: DRM_ERROR("tried to enable vblank on non-existent crtc %d\n", crtc); - return EINVAL; + return -EINVAL; } } diff --git a/drivers/isdn/hardware/mISDN/hfcmulti.c b/drivers/isdn/hardware/mISDN/hfcmulti.c index faed794..cfb45c9 100644 --- a/drivers/isdn/hardware/mISDN/hfcmulti.c +++ b/drivers/isdn/hardware/mISDN/hfcmulti.c @@ -2846,7 +2846,7 @@ mode_hfcmulti(struct hfc_multi *hc, int ch, int protocol, int slot_tx, int conf; if (ch < 0 || ch > 31) - return EINVAL; + return -EINVAL; oslot_tx = hc->chan[ch].slot_tx; oslot_rx = hc->chan[ch].slot_rx; conf = hc->chan[ch].conf; diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c index d9fa3d2..0a8a6a4 100644 --- a/fs/ocfs2/dlm/dlmrecovery.c +++ b/fs/ocfs2/dlm/dlmrecovery.c @@ -2639,7 +2639,7 @@ int dlm_begin_reco_handler(struct o2net_msg *msg, u32 len, void *data, dlm->name, br->node_idx, br->dead_node, dlm->reco.dead_node, dlm->reco.new_master); spin_unlock(&dlm->spinlock); - return EAGAIN; + return -EAGAIN; } spin_unlock(&dlm->spinlock); diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h index d522dcf..5e31447 100644 --- a/include/net/inet_hashtables.h +++ b/include/net/inet_hashtables.h @@ -193,7 +193,7 @@ static inline int inet_ehash_locks_alloc(struct inet_hashinfo *hashinfo) hashinfo->ehash_locks = kmalloc(size * sizeof(spinlock_t), GFP_KERNEL); if (!hashinfo->ehash_locks) - return ENOMEM; + return -ENOMEM; for (i = 0; i < size; i++) spin_lock_init(&hashinfo->ehash_locks[i]); } From airlied at gmail.com Thu Nov 12 00:43:26 2009 From: airlied at gmail.com (Dave Airlie) Date: Thu, 12 Nov 2009 18:43:26 +1000 Subject: [Ocfs2-devel] [patch] Fix: 'return -ENOMEM' instead of 'return ENOMEM' In-Reply-To: <20091112081043.GA25345@elte.hu> References: <4AFB2C0B.50605@gmail.com> <20091111134730.a0da9e38.akpm@linux-foundation.org> <20091112081043.GA25345@elte.hu> Message-ID: <21d7e9970911120043v42c57acyecf07b4bc002ae12@mail.gmail.com> On Thu, Nov 12, 2009 at 6:10 PM, Ingo Molnar wrote: > > * Andrew Morton wrote: > >> > @@ -3730,7 +3730,7 @@ tracing_stats_read(struct file *filp, char __user *ubuf, >> > >> > ? ? s = kmalloc(sizeof(*s), GFP_KERNEL); >> > ? ? if (!s) >> > - ? ? ? ? ? return ENOMEM; >> > + ? ? ? ? ? return -ENOMEM; >> > >> > ? ? trace_seq_init(s); >> > >> >> lol, there we go again. >> >> Andy, can we have a checkpatch rule please? > > Note, that will upset creative uses of error codes i guess, such as > fs/xfs/. > > But yeah, +1 from me too. > > Ob'post'mortem - looked for similar patterns in the kernel and there's > quite a few bugs there: > > ?include/net/inet_hashtables.h: ? ? ? ? ? ? ? ? ?return ENOMEM; ? ? ? ? # bug > ?drivers/scsi/aic7xxx/aic7xxx_osm.c: ? ? ? ? ? ? return ENOMEM; ? ? ? ? # works but weird > ?drivers/scsi/cxgb3i/cxgb3i_offload.c: ? ? ? ? ? return ENOMEM; ? ? ? ? # works but weird > ?fs/ocfs2/dlm/dlmrecovery.c: ? ? ? ? ? ?return EAGAIN; ? ? ? ? ? ? ? ? ?# bug > ?drivers/block/cciss_scsi.c: ? ? ? ? ? ? return ENXIO; ? ? ? ? ? ? ? ? ?# works but weird > ?drivers/gpu/drm/radeon/radeon_irq.c: ? ? ? ? ? ? ? ? ? ?return EINVAL; # bug > ?drivers/gpu/drm/radeon/radeon_irq.c: ? ? ? ? ? ? ? ? ? ?return EINVAL; # bug > ?drivers/isdn/hardware/mISDN/hfcmulti.c: ? ? ? ? return EINVAL; ? ? ? ? # bug > > 5 out of 8 places look buggy - i.e. more than 60% - a checkpatch warning > would avoid real bugs here. (even ignoring the cleanliness effects of > using proper error propagation) > > Cc:-ed affected maintainers. The rightmost column are my observations. > Below is the patch fixing these. > > ? ? ? ?Ingo > > Signed-off-by: Ingo Molnar Looks good to me for radeon bits. Acked-by: Dave Airlie Dave. From roel.kluin at gmail.com Thu Nov 12 01:31:23 2009 From: roel.kluin at gmail.com (roel kluin) Date: Thu, 12 Nov 2009 10:31:23 +0100 Subject: [Ocfs2-devel] [patch] Fix: 'return -ENOMEM' instead of 'return ENOMEM' In-Reply-To: <20091112081043.GA25345@elte.hu> References: <4AFB2C0B.50605@gmail.com> <20091111134730.a0da9e38.akpm@linux-foundation.org> <20091112081043.GA25345@elte.hu> Message-ID: <25e057c00911120131q577f18c5v479b9d6f5f8616a6@mail.gmail.com> > * Andrew Morton wrote: >> Andy, can we have a checkpatch rule please? > > Note, that will upset creative uses of error codes i guess, such as > fs/xfs/. > > But yeah, +1 from me too. > > Ob'post'mortem - looked for similar patterns in the kernel and there's > quite a few bugs there: > > ?include/net/inet_hashtables.h: ? ? ? ? ? ? ? ? ?return ENOMEM; ? ? ? ? # bug > ?drivers/scsi/aic7xxx/aic7xxx_osm.c: ? ? ? ? ? ? return ENOMEM; ? ? ? ? # works but weird > ?drivers/scsi/cxgb3i/cxgb3i_offload.c: ? ? ? ? ? return ENOMEM; ? ? ? ? # works but weird > ?fs/ocfs2/dlm/dlmrecovery.c: ? ? ? ? ? ?return EAGAIN; ? ? ? ? ? ? ? ? ?# bug > ?drivers/block/cciss_scsi.c: ? ? ? ? ? ? return ENXIO; ? ? ? ? ? ? ? ? ?# works but weird > ?drivers/gpu/drm/radeon/radeon_irq.c: ? ? ? ? ? ? ? ? ? ?return EINVAL; # bug > ?drivers/gpu/drm/radeon/radeon_irq.c: ? ? ? ? ? ? ? ? ? ?return EINVAL; # bug > ?drivers/isdn/hardware/mISDN/hfcmulti.c: ? ? ? ? return EINVAL; ? ? ? ? # bug I noticed some of these as well. I found some more and sent a few patches last night with a regex like: git grep -n -E "[^=]=[[:space:]]*E[[:upper:]2]+ *;" I am not 100% sure this doesn't give many falsies, I am not at home so cannot test right now. Something like this can show how common/uncommon these are: git grep -E "[^=]=[[:space:]]*E[[:upper:]2]+ *;" | sed -r "s/^([^:]*:).*(return|[^=]=)[[:space:]]*(-?E)[[:upper:]2]+ *;.*$/\1 \3/" | sort | uniq -c > 5 out of 8 places look buggy - i.e. more than 60% - a checkpatch warning > would avoid real bugs here. (even ignoring the cleanliness effects of > using proper error propagation) > ? ? ? ?Ingo Thanks for picking this up, Roel From michaelc at cs.wisc.edu Thu Nov 12 07:10:53 2009 From: michaelc at cs.wisc.edu (Mike Christie) Date: Thu, 12 Nov 2009 09:10:53 -0600 Subject: [Ocfs2-devel] [patch] Fix: 'return -ENOMEM' instead of 'return ENOMEM' In-Reply-To: <25e057c00911120131q577f18c5v479b9d6f5f8616a6@mail.gmail.com> References: <4AFB2C0B.50605@gmail.com> <20091111134730.a0da9e38.akpm@linux-foundation.org> <20091112081043.GA25345@elte.hu> <25e057c00911120131q577f18c5v479b9d6f5f8616a6@mail.gmail.com> Message-ID: <4AFC257D.2050906@cs.wisc.edu> roel kluin wrote: >> * Andrew Morton wrote: > >>> Andy, can we have a checkpatch rule please? >> Note, that will upset creative uses of error codes i guess, such as >> fs/xfs/. >> >> But yeah, +1 from me too. >> >> Ob'post'mortem - looked for similar patterns in the kernel and there's >> quite a few bugs there: >> >> include/net/inet_hashtables.h: return ENOMEM; # bug >> drivers/scsi/aic7xxx/aic7xxx_osm.c: return ENOMEM; # works but weird >> drivers/scsi/cxgb3i/cxgb3i_offload.c: return ENOMEM; # works but weird I think cxgb3i is actually in the buggy category. cxgb3i_c3cn_send_pdus can propagate the positive EXYZ error value to other functions which assume that errors are negative. Karen, I made the attached patch over James's scsi-rc-fixes tree while reviewing the code. Could you test, finish up and send upstream? -------------- next part -------------- A non-text attachment was scrubbed... Name: cxgb3i-use-negative-errno.patch Type: text/x-patch Size: 2523 bytes Desc: not available Url : http://oss.oracle.com/pipermail/ocfs2-devel/attachments/20091112/09f1764b/attachment.bin From Joel.Becker at oracle.com Thu Nov 12 11:17:58 2009 From: Joel.Becker at oracle.com (Joel Becker) Date: Thu, 12 Nov 2009 11:17:58 -0800 Subject: [Ocfs2-devel] [patch] Fix: 'return -ENOMEM' instead of 'return ENOMEM' In-Reply-To: <20091112081043.GA25345@elte.hu> References: <4AFB2C0B.50605@gmail.com> <20091111134730.a0da9e38.akpm@linux-foundation.org> <20091112081043.GA25345@elte.hu> Message-ID: <20091112191758.GA22985@mail.oracle.com> On Thu, Nov 12, 2009 at 09:10:43AM +0100, Ingo Molnar wrote: > 5 out of 8 places look buggy - i.e. more than 60% - a checkpatch warning > would avoid real bugs here. (even ignoring the cleanliness effects of > using proper error propagation) > > Cc:-ed affected maintainers. The rightmost column are my observations. > Below is the patch fixing these. Acked-by: Joel Becker -- "Can any of you seriously say the Bill of Rights could get through Congress today? It wouldn't even get out of committee." - F. Lee Bailey Joel Becker Principal Software Developer Oracle E-mail: joel.becker at oracle.com Phone: (650) 506-8127 From Joel.Becker at oracle.com Thu Nov 12 12:27:29 2009 From: Joel.Becker at oracle.com (Joel Becker) Date: Thu, 12 Nov 2009 12:27:29 -0800 Subject: [Ocfs2-devel] [patch] Fix: 'return -ENOMEM' instead of 'return ENOMEM' In-Reply-To: <20091112191758.GA22985@mail.oracle.com> References: <4AFB2C0B.50605@gmail.com> <20091111134730.a0da9e38.akpm@linux-foundation.org> <20091112081043.GA25345@elte.hu> <20091112191758.GA22985@mail.oracle.com> Message-ID: <20091112202728.GC22985@mail.oracle.com> On Thu, Nov 12, 2009 at 11:17:58AM -0800, Joel Becker wrote: > On Thu, Nov 12, 2009 at 09:10:43AM +0100, Ingo Molnar wrote: > > 5 out of 8 places look buggy - i.e. more than 60% - a checkpatch warning > > would avoid real bugs here. (even ignoring the cleanliness effects of > > using proper error propagation) > > > > Cc:-ed affected maintainers. The rightmost column are my observations. > > Below is the patch fixing these. > > Acked-by: Joel Becker I take that back. NAK. Sorry, I read the code wrong. This function is just a handler. The caller, dlm_send_begin_reco_message(), expects the positive EAGAIN as a non-error case. Joel -- Life's Little Instruction Book #337 "Reread your favorite book." Joel Becker Principal Software Developer Oracle E-mail: joel.becker at oracle.com Phone: (650) 506-8127 From Joel.Becker at oracle.com Thu Nov 12 15:36:11 2009 From: Joel.Becker at oracle.com (Joel Becker) Date: Thu, 12 Nov 2009 15:36:11 -0800 Subject: [Ocfs2-devel] ocfs2 1.6 - fourth set In-Reply-To: <1257997205-18055-1-git-send-email-sunil.mushran@oracle.com> References: <1257997205-18055-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <20091112233611.GD22985@mail.oracle.com> On Wed, Nov 11, 2009 at 07:39:57PM -0800, Sunil Mushran wrote: > The next set. The previous 3 sets have been pushed to the git repo. Ack. Joel -- f/8 and be there. Joel Becker Principal Software Developer Oracle E-mail: joel.becker at oracle.com Phone: (650) 506-8127 From sunil.mushran at oracle.com Thu Nov 12 17:47:31 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Thu, 12 Nov 2009 17:47:31 -0800 Subject: [Ocfs2-devel] [PATCH 10/18] ocfs2: Handle missing bdi_init()/bdi_destroy() In-Reply-To: <1258076859-13538-1-git-send-email-sunil.mushran@oracle.com> References: <1258076859-13538-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1258076859-13538-11-git-send-email-sunil.mushran@oracle.com> Mainline commit e0bf68ddec4f4f90e5871404be4f1854c17f3120 added bdi_init() and bdi_destroy(). Patch adds empty inlines to allow building with EL5. Signed-off-by: Sunil Mushran --- Makefile | 3 ++- configure.in | 5 +++++ kapi-compat/include/bdi_init.h | 14 ++++++++++++++ 3 files changed, 21 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/bdi_init.h diff --git a/Makefile b/Makefile index 0dd7443..68f746e 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/blkdev_get.h \ kapi-compat/include/configfs.h \ kapi-compat/include/su_mutex.h \ - kapi-compat/include/sock_shutdown.h + kapi-compat/include/sock_shutdown.h \ + kapi-compat/include/bdi_init.h PATCH_FILES = diff --git a/configure.in b/configure.in index e045fa8..53deffd 100644 --- a/configure.in +++ b/configure.in @@ -364,6 +364,11 @@ OCFS2_CHECK_KERNEL([kernel_sock_shutdown() in net.t], net.h, , sock_shutdown_header=sock_shutdown.h, [^extern int kernel_sock_shutdown(struct socket \*sock]) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $sock_shutdown_header" +bdi_init_compat_header= +OCFS2_CHECK_KERNEL([bdi_init() in backing-dev.h], backing-dev.h, + , bdi_init_compat_header=bdi_init.h, [^int bdi_init(struct backing_dev_info \*bdi);]) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $bdi_init_compat_header" + # End kapi_compat checks # using -include has two advantages: diff --git a/kapi-compat/include/bdi_init.h b/kapi-compat/include/bdi_init.h new file mode 100644 index 0000000..2966533 --- /dev/null +++ b/kapi-compat/include/bdi_init.h @@ -0,0 +1,14 @@ +#ifndef KAPI_BDI_INIT_H +#define KAPI_BDI_INIT_H + +static inline int bdi_init(struct backing_dev_info *bdi) +{ + return 0; +} + +static inline void bdi_destroy(struct backing_dev_info *bdi) +{ + return ; +} + +#endif -- 1.5.6.5 From sunil.mushran at oracle.com Thu Nov 12 17:47:24 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Thu, 12 Nov 2009 17:47:24 -0800 Subject: [Ocfs2-devel] [PATCH 03/18] ocfs2: Handle missing dtor in kmem_cache_create() In-Reply-To: <1258076859-13538-1-git-send-email-sunil.mushran@oracle.com> References: <1258076859-13538-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1258076859-13538-4-git-send-email-sunil.mushran@oracle.com> Mainline commit 20c2df83d25c6a95affe6157a4c9cac4cf5ffaac removed the dtor arg from kmem_cache_create(). Patch adds a kapi macro that adds a dtor arg when building against EL5 kernels. Signed-off-by: Sunil Mushran --- Config.make.in | 1 + Makefile | 3 ++- configure.in | 6 ++++++ fs/ocfs2/Makefile | 4 ++++ fs/ocfs2/dlm/Makefile | 4 ++++ fs/ocfs2/dlm/dlmfs.c | 7 ++++++- fs/ocfs2/dlm/dlmlock.c | 2 +- fs/ocfs2/dlm/dlmmaster.c | 6 +++--- fs/ocfs2/dlm/kapi-default.h | 4 ++++ fs/ocfs2/kapi-default.h | 4 ++++ fs/ocfs2/super.c | 11 ++++++++--- fs/ocfs2/uptodate.c | 2 +- kapi-compat/include/slab.h | 8 ++++++++ 13 files changed, 52 insertions(+), 10 deletions(-) create mode 100644 kapi-compat/include/slab.h diff --git a/Config.make.in b/Config.make.in index a19d096..fb705b5 100644 --- a/Config.make.in +++ b/Config.make.in @@ -72,6 +72,7 @@ VMOP_IS_NOT_CONST = @VMOP_IS_NOT_CONST@ SEQOP_IS_NOT_CONST = @SEQOP_IS_NOT_CONST@ NO_VECTORIZED_AIO = @NO_VECTORIZED_AIO@ OLD_PERMISSION = @OLD_PERMISSION@ +KMEM_CACHE_CREATE_DTOR = @KMEM_CACHE_CREATE_DTOR@ OCFS_DEBUG = @OCFS_DEBUG@ diff --git a/Makefile b/Makefile index adaf9fb..912fb70 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/fsuid.h \ kapi-compat/include/umh_wait.h \ kapi-compat/include/register_sysctl.h \ - kapi-compat/include/sysctl.h + kapi-compat/include/sysctl.h \ + kapi-compat/include/slab.h PATCH_FILES = diff --git a/configure.in b/configure.in index b662f88..98cdc5d 100644 --- a/configure.in +++ b/configure.in @@ -328,6 +328,12 @@ OCFS2_CHECK_KERNEL([enum FS_OCFS2 in sysctl.h], sysctl.h, , sysctl_compat_header=sysctl.h, [FS_OCFS2=]) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $sysctl_compat_header" +KMEM_CACHE_CREATE_DTOR= +OCFS2_CHECK_KERNEL([ older prototype of kmem_cache_create() in slab.h], slab.h, + KMEM_CACHE_CREATE_DTOR=slab.h, , [^.*void (\*)(void \*, kmem_cache_t \*, unsigned long),]) +AC_SUBST(KMEM_CACHE_CREATE_DTOR) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $KMEM_CACHE_CREATE_DTOR" + # End kapi_compat checks # using -include has two advantages: diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile index 32d864d..c769fd8 100644 --- a/fs/ocfs2/Makefile +++ b/fs/ocfs2/Makefile @@ -92,6 +92,10 @@ ifdef OLD_PERMISSION EXTRA_CFLAGS += -DOLD_PERMISSION endif +ifdef KMEM_CACHE_CREATE_DTOR +EXTRA_CFLAGS += -DKMEM_CACHE_CREATE_DTOR +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes. diff --git a/fs/ocfs2/dlm/Makefile b/fs/ocfs2/dlm/Makefile index 0c4d1f4..907e390 100644 --- a/fs/ocfs2/dlm/Makefile +++ b/fs/ocfs2/dlm/Makefile @@ -42,6 +42,10 @@ ifdef SEQOP_IS_NOT_CONST EXTRA_CFLAGS += -DSEQOP_IS_NOT_CONST endif +ifdef KMEM_CACHE_CREATE_DTOR +EXTRA_CFLAGS += -DKMEM_CACHE_CREATE_DTOR +endif + DLM_SOURCES += \ dlmast.c \ dlmconvert.c \ diff --git a/fs/ocfs2/dlm/dlmfs.c b/fs/ocfs2/dlm/dlmfs.c index d05653d..6d97173 100644 --- a/fs/ocfs2/dlm/dlmfs.c +++ b/fs/ocfs2/dlm/dlmfs.c @@ -277,7 +277,12 @@ static ssize_t dlmfs_file_write(struct file *filp, return writelen; } +#ifdef KMEM_CACHE_CREATE_DTOR +static void dlmfs_init_once(void *foo, struct kmem_cache *cachep, + unsigned long flags) +#else static void dlmfs_init_once(void *foo) +#endif { struct dlmfs_inode_private *ip = (struct dlmfs_inode_private *) foo; @@ -628,7 +633,7 @@ static int __init init_dlmfs_fs(void) if (status) return status; - dlmfs_inode_cache = kmem_cache_create("dlmfs_inode_cache", + dlmfs_inode_cache = kapi_kmem_cache_create("dlmfs_inode_cache", sizeof(struct dlmfs_inode_private), 0, (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT| SLAB_MEM_SPREAD), diff --git a/fs/ocfs2/dlm/dlmlock.c b/fs/ocfs2/dlm/dlmlock.c index 437698e..98840f9 100644 --- a/fs/ocfs2/dlm/dlmlock.c +++ b/fs/ocfs2/dlm/dlmlock.c @@ -67,7 +67,7 @@ static void dlm_lock_detach_lockres(struct dlm_lock *lock); int dlm_init_lock_cache(void) { - dlm_lock_cache = kmem_cache_create("o2dlm_lock", + dlm_lock_cache = kapi_kmem_cache_create("o2dlm_lock", sizeof(struct dlm_lock), 0, SLAB_HWCACHE_ALIGN, NULL); if (dlm_lock_cache == NULL) diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c index 83bcaf2..90d3157 100644 --- a/fs/ocfs2/dlm/dlmmaster.c +++ b/fs/ocfs2/dlm/dlmmaster.c @@ -406,7 +406,7 @@ static void dlm_mle_node_up(struct dlm_ctxt *dlm, int dlm_init_mle_cache(void) { - dlm_mle_cache = kmem_cache_create("o2dlm_mle", + dlm_mle_cache = kapi_kmem_cache_create("o2dlm_mle", sizeof(struct dlm_master_list_entry), 0, SLAB_HWCACHE_ALIGN, NULL); @@ -457,13 +457,13 @@ static void dlm_mle_release(struct kref *kref) int dlm_init_master_caches(void) { - dlm_lockres_cache = kmem_cache_create("o2dlm_lockres", + dlm_lockres_cache = kapi_kmem_cache_create("o2dlm_lockres", sizeof(struct dlm_lock_resource), 0, SLAB_HWCACHE_ALIGN, NULL); if (!dlm_lockres_cache) goto bail; - dlm_lockname_cache = kmem_cache_create("o2dlm_lockname", + dlm_lockname_cache = kapi_kmem_cache_create("o2dlm_lockname", DLM_LOCKID_NAME_MAX, 0, SLAB_HWCACHE_ALIGN, NULL); if (!dlm_lockname_cache) diff --git a/fs/ocfs2/dlm/kapi-default.h b/fs/ocfs2/dlm/kapi-default.h index 21e5e3a..bcdb486 100644 --- a/fs/ocfs2/dlm/kapi-default.h +++ b/fs/ocfs2/dlm/kapi-default.h @@ -29,4 +29,8 @@ typedef struct work_struct kapi_work_struct_t; # define KAPI_INIT_DELAYED_WORK(a, b, c) INIT_DELAYED_WORK(a, b) #endif +#ifndef kapi_kmem_cache_create +# define kapi_kmem_cache_create(a, b, c, d, e) kmem_cache_create(a, b, c, d, e) +#endif + #endif diff --git a/fs/ocfs2/kapi-default.h b/fs/ocfs2/kapi-default.h index 7489a19..2f60b87 100644 --- a/fs/ocfs2/kapi-default.h +++ b/fs/ocfs2/kapi-default.h @@ -50,4 +50,8 @@ typedef u64 f_version_t; # define kapi_register_sysctl_table(a) register_sysctl_table(a) #endif +#ifndef kapi_kmem_cache_create +# define kapi_kmem_cache_create(a, b, c, d, e) kmem_cache_create(a, b, c, d, e) +#endif + #endif diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index bee2c31..e36bec2 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c @@ -1671,7 +1671,12 @@ bail: return status; } +#ifdef KMEM_CACHE_CREATE_DTOR +static void ocfs2_inode_init_once(void *data, struct kmem_cache *cachep, + unsigned long flags) +#else static void ocfs2_inode_init_once(void *data) +#endif { struct ocfs2_inode_info *oi = data; @@ -1701,19 +1706,19 @@ static void ocfs2_inode_init_once(void *data) static int ocfs2_initialize_mem_caches(void) { - ocfs2_inode_cachep = kmem_cache_create("ocfs2_inode_cache", + ocfs2_inode_cachep = kapi_kmem_cache_create("ocfs2_inode_cache", sizeof(struct ocfs2_inode_info), 0, (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT| SLAB_MEM_SPREAD), ocfs2_inode_init_once); - ocfs2_dquot_cachep = kmem_cache_create("ocfs2_dquot_cache", + ocfs2_dquot_cachep = kapi_kmem_cache_create("ocfs2_dquot_cache", sizeof(struct ocfs2_dquot), 0, (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT| SLAB_MEM_SPREAD), NULL); - ocfs2_qf_chunk_cachep = kmem_cache_create("ocfs2_qf_chunk_cache", + ocfs2_qf_chunk_cachep = kapi_kmem_cache_create("ocfs2_qf_chunk_cache", sizeof(struct ocfs2_quota_chunk), 0, (SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD), diff --git a/fs/ocfs2/uptodate.c b/fs/ocfs2/uptodate.c index b6284f2..fe57890 100644 --- a/fs/ocfs2/uptodate.c +++ b/fs/ocfs2/uptodate.c @@ -625,7 +625,7 @@ void ocfs2_remove_xattr_clusters_from_cache(struct ocfs2_caching_info *ci, int __init init_ocfs2_uptodate_cache(void) { - ocfs2_uptodate_cachep = kmem_cache_create("ocfs2_uptodate", + ocfs2_uptodate_cachep = kapi_kmem_cache_create("ocfs2_uptodate", sizeof(struct ocfs2_meta_cache_item), 0, SLAB_HWCACHE_ALIGN, NULL); if (!ocfs2_uptodate_cachep) diff --git a/kapi-compat/include/slab.h b/kapi-compat/include/slab.h new file mode 100644 index 0000000..c682289 --- /dev/null +++ b/kapi-compat/include/slab.h @@ -0,0 +1,8 @@ +#ifndef KAPI_SLAB_H +#define KAPI_SLAB_H + +#ifdef KMEM_CACHE_CREATE_DTOR +# define kapi_kmem_cache_create(a, b, c, d, e) kmem_cache_create(a, b, c, d, e, NULL) +#endif + +#endif -- 1.5.6.5 From sunil.mushran at oracle.com Thu Nov 12 17:47:22 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Thu, 12 Nov 2009 17:47:22 -0800 Subject: [Ocfs2-devel] [PATCH 01/18] ocfs2: Add kapi-default.h in cluster and dlm In-Reply-To: <1258076859-13538-1-git-send-email-sunil.mushran@oracle.com> References: <1258076859-13538-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1258076859-13538-2-git-send-email-sunil.mushran@oracle.com> Commit 19582597eec08f61b6f5794c15f6f2c9821a67d9 added kapi-default.h in fs/ocfs2. This patch adds a similar named file in fs/ocfs2/cluster and fs/ocfs2/dlm to allow building against the mainline without kapi-compat headers. Signed-off-by: Sunil Mushran --- fs/ocfs2/cluster/Makefile | 2 +- fs/ocfs2/cluster/kapi-default.h | 26 ++++++++++++++++++++++++++ fs/ocfs2/dlm/Makefile | 2 +- fs/ocfs2/dlm/kapi-default.h | 26 ++++++++++++++++++++++++++ 4 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 fs/ocfs2/cluster/kapi-default.h create mode 100644 fs/ocfs2/dlm/kapi-default.h diff --git a/fs/ocfs2/cluster/Makefile b/fs/ocfs2/cluster/Makefile index d89112d..1f040c6 100644 --- a/fs/ocfs2/cluster/Makefile +++ b/fs/ocfs2/cluster/Makefile @@ -12,7 +12,7 @@ include $(OUR_TOPDIR)/Config.make endif COMPAT_SOURCES = -COMPAT_HEADERS = +COMPAT_HEADERS = kapi-default.h SOURCES = HEADERS = diff --git a/fs/ocfs2/cluster/kapi-default.h b/fs/ocfs2/cluster/kapi-default.h new file mode 100644 index 0000000..fcf3ac9 --- /dev/null +++ b/fs/ocfs2/cluster/kapi-default.h @@ -0,0 +1,26 @@ +/* -*- mode: c; c-basic-offset: 8; -*- + * vim: noexpandtab sw=8 ts=8 sts=0: + * + * kapi-default.h + * + * Defines kapi-compat macros and structures used in OCFS2 + * + * Copyright (C) 2009 Oracle. All rights reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + */ + +#ifndef KAPI_DEFAULT_H +#define KAPI_DEFAULT_H + + +#endif diff --git a/fs/ocfs2/dlm/Makefile b/fs/ocfs2/dlm/Makefile index 122b370..0c4d1f4 100644 --- a/fs/ocfs2/dlm/Makefile +++ b/fs/ocfs2/dlm/Makefile @@ -13,7 +13,7 @@ include $(OUR_TOPDIR)/Config.make endif COMPAT_SOURCES = -COMPAT_HEADERS = +COMPAT_HEADERS = kapi-default.h DLM_SOURCES = DLMFS_SOURCES = HEADERS = diff --git a/fs/ocfs2/dlm/kapi-default.h b/fs/ocfs2/dlm/kapi-default.h new file mode 100644 index 0000000..fcf3ac9 --- /dev/null +++ b/fs/ocfs2/dlm/kapi-default.h @@ -0,0 +1,26 @@ +/* -*- mode: c; c-basic-offset: 8; -*- + * vim: noexpandtab sw=8 ts=8 sts=0: + * + * kapi-default.h + * + * Defines kapi-compat macros and structures used in OCFS2 + * + * Copyright (C) 2009 Oracle. All rights reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + */ + +#ifndef KAPI_DEFAULT_H +#define KAPI_DEFAULT_H + + +#endif -- 1.5.6.5 From sunil.mushran at oracle.com Thu Nov 12 17:47:27 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Thu, 12 Nov 2009 17:47:27 -0800 Subject: [Ocfs2-devel] [PATCH 06/18] ocfs2: Handle older prototype of blkdev_get() In-Reply-To: <1258076859-13538-1-git-send-email-sunil.mushran@oracle.com> References: <1258076859-13538-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1258076859-13538-7-git-send-email-sunil.mushran@oracle.com> Mainline commit 572c48921574dbe6dceb958cf965aa962baefde4 removed the flags argument in blkdev_get(). Patch allows building against EL5 by forcing a 0 in place of that argument. This is ok as we are not using that argument. Signed-off-by: Sunil Mushran --- Makefile | 3 ++- configure.in | 5 +++++ fs/ocfs2/cluster/heartbeat.c | 2 +- fs/ocfs2/cluster/kapi-default.h | 4 ++++ kapi-compat/include/blkdev_get.h | 6 ++++++ 5 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 kapi-compat/include/blkdev_get.h diff --git a/Makefile b/Makefile index a94d345..5e1bb62 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/register_sysctl.h \ kapi-compat/include/sysctl.h \ kapi-compat/include/slab.h \ - kapi-compat/include/blkdev_put.h + kapi-compat/include/blkdev_put.h \ + kapi-compat/include/blkdev_get.h PATCH_FILES = diff --git a/configure.in b/configure.in index 6c93e2f..8ce5e67 100644 --- a/configure.in +++ b/configure.in @@ -344,6 +344,11 @@ OCFS2_CHECK_KERNEL([ older prototype of blkdev_put() in fs.h], fs.h, blkdev_put_header=blkdev_put.h, , [^extern int blkdev_put(struct block_device \*);]) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $blkdev_put_header" +blkdev_get_header= +OCFS2_CHECK_KERNEL([ older prototype of blkdev_get() in fs.h], fs.h, + blkdev_get_header=blkdev_get.h, , [^extern int blkdev_get(struct block_device \*, mode_t, unsigned);]) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $blkdev_get_header" + # End kapi_compat checks # using -include has two advantages: diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c index ed05786..3d3e306 100644 --- a/fs/ocfs2/cluster/heartbeat.c +++ b/fs/ocfs2/cluster/heartbeat.c @@ -1368,7 +1368,7 @@ static ssize_t o2hb_region_dev_write(struct o2hb_region *reg, goto out; reg->hr_bdev = I_BDEV(filp->f_mapping->host); - ret = blkdev_get(reg->hr_bdev, FMODE_WRITE | FMODE_READ); + ret = kapi_blkdev_get(reg->hr_bdev, FMODE_WRITE | FMODE_READ); if (ret) { reg->hr_bdev = NULL; goto out; diff --git a/fs/ocfs2/cluster/kapi-default.h b/fs/ocfs2/cluster/kapi-default.h index ded908a..fc3da05 100644 --- a/fs/ocfs2/cluster/kapi-default.h +++ b/fs/ocfs2/cluster/kapi-default.h @@ -33,4 +33,8 @@ typedef struct work_struct kapi_work_struct_t; # define kapi_blkdev_put blkdev_put #endif +#ifndef kapi_blkdev_get +# define kapi_blkdev_get blkdev_get +#endif + #endif diff --git a/kapi-compat/include/blkdev_get.h b/kapi-compat/include/blkdev_get.h new file mode 100644 index 0000000..dcf7425 --- /dev/null +++ b/kapi-compat/include/blkdev_get.h @@ -0,0 +1,6 @@ +#ifndef KAPI_BLKDEV_GET_H +#define KAPI_BLKDEV_GET_H + +#define kapi_blkdev_get(a, b) blkdev_get(a, b, 0) + +#endif -- 1.5.6.5 From sunil.mushran at oracle.com Thu Nov 12 17:47:37 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Thu, 12 Nov 2009 17:47:37 -0800 Subject: [Ocfs2-devel] [PATCH 16/18] ocfs2: Handle missing struct path in struct nameidata In-Reply-To: <1258076859-13538-1-git-send-email-sunil.mushran@oracle.com> References: <1258076859-13538-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1258076859-13538-17-git-send-email-sunil.mushran@oracle.com> Mainline commit 4ac9137858e08a19f29feac4e1f4df7c268b0ba5 embedded struct path into struct nameidata. Mainline commit 2d8f30380ab8c706f4e0a8f1aaa22b5886e9ac8a added new helpers like user_path_at() that passed struct path instead of struct nameidata. Patch adds access wrappers to allow building against current and EL5 kernels. Signed-off-by: Sunil Mushran --- Makefile | 3 ++- configure.in | 5 +++++ fs/ocfs2/kapi-default.h | 9 +++++++++ fs/ocfs2/refcounttree.c | 18 +++++++++--------- kapi-compat/include/user_path_at.h | 11 +++++++++++ 5 files changed, 36 insertions(+), 10 deletions(-) create mode 100644 kapi-compat/include/user_path_at.h diff --git a/Makefile b/Makefile index 8536d51..3447409 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/bdi_init.h \ kapi-compat/include/bdi_define.h \ kapi-compat/include/inode_permission.h \ - kapi-compat/include/should_remove_suid.h + kapi-compat/include/should_remove_suid.h \ + kapi-compat/include/user_path_at.h PATCH_FILES = diff --git a/configure.in b/configure.in index 3b8fd4e..86dc11b 100644 --- a/configure.in +++ b/configure.in @@ -399,6 +399,11 @@ fi AC_SUBST(NO_SHOULD_REMOVE_SUID) AC_MSG_RESULT($enable_srsuid) +user_path_header= +OCFS2_CHECK_KERNEL([struct path in struct nameidata in namei.h], namei.h, + , user_path_header=user_path_at.h, [struct path.*path;]) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $user_path_header" + # End kapi_compat checks # using -include has two advantages: diff --git a/fs/ocfs2/kapi-default.h b/fs/ocfs2/kapi-default.h index 2f60b87..7b16678 100644 --- a/fs/ocfs2/kapi-default.h +++ b/fs/ocfs2/kapi-default.h @@ -54,4 +54,13 @@ typedef u64 f_version_t; # define kapi_kmem_cache_create(a, b, c, d, e) kmem_cache_create(a, b, c, d, e) #endif +#ifndef kapi_path +# define kapi_path path +# define kapi_path_put path_put +# define kapi_user_path_at(a, b, c, d) user_path_at(a, b, c, d) +# define kapi_to_mnt(a) (a).path.mnt +# define kapi_to_dentry(a) (a).path.dentry +# define kapi_to_path_ptr(a) (&(a).path) +#endif + #endif diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c index 60287fc..49771c3 100644 --- a/fs/ocfs2/refcounttree.c +++ b/fs/ocfs2/refcounttree.c @@ -4260,14 +4260,14 @@ int ocfs2_reflink_ioctl(struct inode *inode, { struct dentry *new_dentry; struct nameidata nd; - struct path old_path; + struct kapi_path old_path; int error; char *to = NULL; if (!ocfs2_refcount_tree(OCFS2_SB(inode->i_sb))) return -EOPNOTSUPP; - error = user_path_at(AT_FDCWD, oldname, 0, &old_path); + error = kapi_user_path_at(AT_FDCWD, oldname, 0, &old_path); if (error) { mlog_errno(error); return error; @@ -4280,7 +4280,7 @@ int ocfs2_reflink_ioctl(struct inode *inode, } error = -EXDEV; - if (old_path.mnt != nd.path.mnt) + if (old_path.mnt != kapi_to_mnt(nd)) goto out_release; new_dentry = lookup_create(&nd, 0); error = PTR_ERR(new_dentry); @@ -4289,25 +4289,25 @@ int ocfs2_reflink_ioctl(struct inode *inode, goto out_unlock; } - error = mnt_want_write(nd.path.mnt); + error = mnt_want_write(kapi_to_mnt(nd)); if (error) { mlog_errno(error); goto out_dput; } error = ocfs2_vfs_reflink(old_path.dentry, - nd.path.dentry->d_inode, + kapi_to_dentry(nd)->d_inode, new_dentry, preserve); - mnt_drop_write(nd.path.mnt); + mnt_drop_write(kapi_to_mnt(nd)); out_dput: dput(new_dentry); out_unlock: - mutex_unlock(&nd.path.dentry->d_inode->i_mutex); + mutex_unlock(&kapi_to_dentry(nd)->d_inode->i_mutex); out_release: - path_put(&nd.path); + kapi_path_put(kapi_to_path_ptr(nd)); putname(to); out: - path_put(&old_path); + kapi_path_put(&old_path); return error; } diff --git a/kapi-compat/include/user_path_at.h b/kapi-compat/include/user_path_at.h new file mode 100644 index 0000000..fc11d36 --- /dev/null +++ b/kapi-compat/include/user_path_at.h @@ -0,0 +1,11 @@ +#ifndef KAPI_USER_WALK_AT_H +#define KAPI_USER_WALK_AT_H + +#define kapi_path nameidata +#define kapi_path_put path_release +#define kapi_user_path_at(a, b, c, d) __user_walk(b, c, d) +#define kapi_to_mnt(a) (a).mnt +#define kapi_to_dentry(a) (a).dentry +#define kapi_to_path_ptr(a) (&(a)) + +#endif -- 1.5.6.5 From sunil.mushran at oracle.com Thu Nov 12 17:47:38 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Thu, 12 Nov 2009 17:47:38 -0800 Subject: [Ocfs2-devel] [PATCH 17/18] ocfs2: Handle missing filemap_fdatawait_range() In-Reply-To: <1258076859-13538-1-git-send-email-sunil.mushran@oracle.com> References: <1258076859-13538-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1258076859-13538-18-git-send-email-sunil.mushran@oracle.com> Mainline commit 918941a3f3d46c2a69971b4718aaf13b1be2f1a7 replaced generic_file_aio_write_nolock() with __generic_file_aio_write() and made use of helpers filemap_fdatawrite_range() and filemap_fdatawait_range(). Patch adds macros to allow building with current and older EL5 kernels. Signed-off-by: Sunil Mushran --- Makefile | 3 ++- configure.in | 5 +++++ fs/ocfs2/file.c | 6 +++--- fs/ocfs2/kapi-default.h | 6 ++++++ kapi-compat/include/filemap_fdatawait_range.h | 8 ++++++++ 5 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 kapi-compat/include/filemap_fdatawait_range.h diff --git a/Makefile b/Makefile index 3447409..7d9e0a9 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/bdi_define.h \ kapi-compat/include/inode_permission.h \ kapi-compat/include/should_remove_suid.h \ - kapi-compat/include/user_path_at.h + kapi-compat/include/user_path_at.h \ + kapi-compat/include/filemap_fdatawait_range.h PATCH_FILES = diff --git a/configure.in b/configure.in index 86dc11b..a992f4b 100644 --- a/configure.in +++ b/configure.in @@ -404,6 +404,11 @@ OCFS2_CHECK_KERNEL([struct path in struct nameidata in namei.h], namei.h, , user_path_header=user_path_at.h, [struct path.*path;]) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $user_path_header" +fdatawait_header= +OCFS2_CHECK_KERNEL([filemap_fdatawait_range() in fs.h], fs.h, + , fdatawait_header=filemap_fdatawait_range.h, [extern int filemap_fdatawait_range(struct address_space \*,]) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $fdatawait_header" + # End kapi_compat checks # using -include has two advantages: diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 4c12c2d..1367586 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c @@ -2002,7 +2002,7 @@ relock: goto out_dio; } } else { - written = __generic_file_aio_write(iocb, iov, nr_segs, ppos); + written = kapi_generic_file_aio_write(iocb, iov, nr_segs, ppos); } out_dio: @@ -2010,7 +2010,7 @@ out_dio: BUG_ON(ret == -EIOCBQUEUED && !(file->f_flags & O_DIRECT)); if ((file->f_flags & O_SYNC && !direct_io) || IS_SYNC(inode)) { - ret = filemap_fdatawrite_range(file->f_mapping, pos, + ret = kapi_filemap_fdatawrite_range(file->f_mapping, pos, pos + count - 1); if (ret < 0) written = ret; @@ -2023,7 +2023,7 @@ out_dio: } if (!ret) - ret = filemap_fdatawait_range(file->f_mapping, pos, + ret = kapi_filemap_fdatawait_range(file->f_mapping, pos, pos + count - 1); } diff --git a/fs/ocfs2/kapi-default.h b/fs/ocfs2/kapi-default.h index 7b16678..b1afdcf 100644 --- a/fs/ocfs2/kapi-default.h +++ b/fs/ocfs2/kapi-default.h @@ -63,4 +63,10 @@ typedef u64 f_version_t; # define kapi_to_path_ptr(a) (&(a).path) #endif +#ifndef kapi_generic_file_aio_write +# define kapi_generic_file_aio_write __generic_file_aio_write +# define kapi_filemap_fdatawrite_range filemap_fdatawrite_range +# define kapi_filemap_fdatawait_range filemap_fdatawait_range +#endif + #endif diff --git a/kapi-compat/include/filemap_fdatawait_range.h b/kapi-compat/include/filemap_fdatawait_range.h new file mode 100644 index 0000000..47840af --- /dev/null +++ b/kapi-compat/include/filemap_fdatawait_range.h @@ -0,0 +1,8 @@ +#ifndef FILEMAP_FDATAWAIT_RANGE_H +#define FILEMAP_FDATAWAIT_RANGE_H + +#define kapi_generic_file_aio_write generic_file_aio_write_nolock +#define kapi_filemap_fdatawrite_range(a, b, c) 0 +#define kapi_filemap_fdatawait_range(a, b, c) 0 + +#endif -- 1.5.6.5 From sunil.mushran at oracle.com Thu Nov 12 17:47:26 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Thu, 12 Nov 2009 17:47:26 -0800 Subject: [Ocfs2-devel] [PATCH 05/18] ocfs2: Handle missing fmode_t in blkdev_put() In-Reply-To: <1258076859-13538-1-git-send-email-sunil.mushran@oracle.com> References: <1258076859-13538-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1258076859-13538-6-git-send-email-sunil.mushran@oracle.com> Mainline commit 9a1c3542768b5a58e45a9216921cd10a3bae1205 added arg fmode_t to blkdev_put(). Patch allows building against EL5 by ignoring that argument. Signed-off-by: Sunil Mushran --- Makefile | 3 ++- configure.in | 5 +++++ fs/ocfs2/cluster/heartbeat.c | 4 ++-- fs/ocfs2/cluster/kapi-default.h | 4 ++++ kapi-compat/include/blkdev_put.h | 6 ++++++ 5 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 kapi-compat/include/blkdev_put.h diff --git a/Makefile b/Makefile index 912fb70..a94d345 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/umh_wait.h \ kapi-compat/include/register_sysctl.h \ kapi-compat/include/sysctl.h \ - kapi-compat/include/slab.h + kapi-compat/include/slab.h \ + kapi-compat/include/blkdev_put.h PATCH_FILES = diff --git a/configure.in b/configure.in index 8696935..6c93e2f 100644 --- a/configure.in +++ b/configure.in @@ -339,6 +339,11 @@ OCFS2_CHECK_KERNEL([ older prototype of bio_end_io_t in bio.h], bio.h, OLD_BIO_END_IO_T=yes, , [^typedef int (bio_end_io_t) (struct bio \*, unsigned int, int);]) AC_SUBST(OLD_BIO_END_IO_T) +blkdev_put_header= +OCFS2_CHECK_KERNEL([ older prototype of blkdev_put() in fs.h], fs.h, + blkdev_put_header=blkdev_put.h, , [^extern int blkdev_put(struct block_device \*);]) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $blkdev_put_header" + # End kapi_compat checks # using -include has two advantages: diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c index d07241f..ed05786 100644 --- a/fs/ocfs2/cluster/heartbeat.c +++ b/fs/ocfs2/cluster/heartbeat.c @@ -1076,7 +1076,7 @@ static void o2hb_region_release(struct config_item *item) } if (reg->hr_bdev) - blkdev_put(reg->hr_bdev, FMODE_READ|FMODE_WRITE); + kapi_blkdev_put(reg->hr_bdev, FMODE_READ|FMODE_WRITE); if (reg->hr_slots) kfree(reg->hr_slots); @@ -1459,7 +1459,7 @@ out: iput(inode); if (ret < 0) { if (reg->hr_bdev) { - blkdev_put(reg->hr_bdev, FMODE_READ|FMODE_WRITE); + kapi_blkdev_put(reg->hr_bdev, FMODE_READ|FMODE_WRITE); reg->hr_bdev = NULL; } } diff --git a/fs/ocfs2/cluster/kapi-default.h b/fs/ocfs2/cluster/kapi-default.h index 21e5e3a..ded908a 100644 --- a/fs/ocfs2/cluster/kapi-default.h +++ b/fs/ocfs2/cluster/kapi-default.h @@ -29,4 +29,8 @@ typedef struct work_struct kapi_work_struct_t; # define KAPI_INIT_DELAYED_WORK(a, b, c) INIT_DELAYED_WORK(a, b) #endif +#ifndef kapi_blkdev_put +# define kapi_blkdev_put blkdev_put +#endif + #endif diff --git a/kapi-compat/include/blkdev_put.h b/kapi-compat/include/blkdev_put.h new file mode 100644 index 0000000..cf30192 --- /dev/null +++ b/kapi-compat/include/blkdev_put.h @@ -0,0 +1,6 @@ +#ifndef KAPI_BLKDEV_PUT_H +#define KAPI_BLKDEV_PUT_H + +#define kapi_blkdev_put(a, b) blkdev_put(a) + +#endif -- 1.5.6.5 From sunil.mushran at oracle.com Thu Nov 12 17:47:39 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Thu, 12 Nov 2009 17:47:39 -0800 Subject: [Ocfs2-devel] [PATCH 18/18] ocfs2: Add fops->sendfile() In-Reply-To: <1258076859-13538-1-git-send-email-sunil.mushran@oracle.com> References: <1258076859-13538-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1258076859-13538-19-git-send-email-sunil.mushran@oracle.com> fops->sendfile() was removed in 2.6.23. Patch re-adds it and uses it if built with EL5. Signed-off-by: Sunil Mushran --- Config.make.in | 1 + configure.in | 5 +++++ fs/ocfs2/Makefile | 4 ++++ fs/ocfs2/file.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 55 insertions(+), 0 deletions(-) diff --git a/Config.make.in b/Config.make.in index 4b5f4c3..02b8c9c 100644 --- a/Config.make.in +++ b/Config.make.in @@ -77,6 +77,7 @@ OLD_BIO_END_IO_T = @OLD_BIO_END_IO_T@ NO_FAULT_IN_VMOPS = @NO_FAULT_IN_VMOPS@ GET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN = @GET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN@ NO_SHOULD_REMOVE_SUID = @NO_SHOULD_REMOVE_SUID@ +HAS_FOPS_SENDFILE = @HAS_FOPS_SENDFILE@ OCFS_DEBUG = @OCFS_DEBUG@ diff --git a/configure.in b/configure.in index a992f4b..5bc9d42 100644 --- a/configure.in +++ b/configure.in @@ -409,6 +409,11 @@ OCFS2_CHECK_KERNEL([filemap_fdatawait_range() in fs.h], fs.h, , fdatawait_header=filemap_fdatawait_range.h, [extern int filemap_fdatawait_range(struct address_space \*,]) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $fdatawait_header" +HAS_FOPS_SENDFILE= +OCFS2_CHECK_KERNEL([ fops->sendfile() in fs.h], fs.h, + HAS_FOPS_SENDFILE=yes, , [^.*ssize_t (\*sendfile)]) +AC_SUBST(HAS_FOPS_SENDFILE) + # End kapi_compat checks # using -include has two advantages: diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile index 4a4c250..2e85623 100644 --- a/fs/ocfs2/Makefile +++ b/fs/ocfs2/Makefile @@ -110,6 +110,10 @@ FS_SOURCES += compat_should_remove_suid.c EXTRA_CFLAGS += -DNO_SHOULD_REMOVE_SUID endif +ifdef HAS_FOPS_SENDFILE +EXTRA_CFLAGS += -DHAS_FOPS_SENDFILE +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes. diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 1367586..de75f5a 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c @@ -2249,6 +2249,45 @@ bail: return ret; } +#ifdef HAS_FOPS_SENDFILE +static ssize_t ocfs2_file_sendfile(struct file *in_file, + loff_t *ppos, + size_t count, + read_actor_t actor, + void *target) +{ + int ret; + struct inode *inode = in_file->f_mapping->host; + + mlog_entry("inode %llu, ppos %lld, count = %u\n", + (unsigned long long)OCFS2_I(inode)->ip_blkno, + (long long) *ppos, + (unsigned int) count); + + /* Obviously, there is no user buffer to worry about here -- + * this simplifies locking, so no need to walk vmas a la + * read/write. We take the cluster lock against the inode + * and call generic_file_sendfile. */ + ret = ocfs2_inode_lock(inode, NULL, 0); + if (ret < 0) { + mlog_errno(ret); + goto bail; + } + + down_read(&OCFS2_I(inode)->ip_alloc_sem); + + ret = generic_file_sendfile(in_file, ppos, count, actor, target); + + up_read(&OCFS2_I(inode)->ip_alloc_sem); + + ocfs2_inode_unlock(inode, 0); + +bail: + mlog_exit(ret); + return ret; +} +#endif + #ifdef IOP_IS_NOT_CONST struct inode_operations ocfs2_file_iops = { #else @@ -2297,6 +2336,9 @@ const struct file_operations ocfs2_fops = { .flock = ocfs2_flock, .splice_read = ocfs2_file_splice_read, .splice_write = ocfs2_file_splice_write, +#ifdef HAS_FOPS_SENDFILE + .sendfile = ocfs2_file_sendfile, +#endif }; const struct file_operations ocfs2_dops = { @@ -2343,6 +2385,9 @@ const struct file_operations ocfs2_fops_no_plocks = { .flock = ocfs2_flock, .splice_read = ocfs2_file_splice_read, .splice_write = ocfs2_file_splice_write, +#ifdef HAS_FOPS_SENDFILE + .sendfile = ocfs2_file_sendfile, +#endif }; const struct file_operations ocfs2_dops_no_plocks = { -- 1.5.6.5 From sunil.mushran at oracle.com Thu Nov 12 17:47:28 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Thu, 12 Nov 2009 17:47:28 -0800 Subject: [Ocfs2-devel] [PATCH 07/18] ocfs2: Handles missing configfs_depend_item() and configfs_undepend_item() In-Reply-To: <1258076859-13538-1-git-send-email-sunil.mushran@oracle.com> References: <1258076859-13538-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1258076859-13538-8-git-send-email-sunil.mushran@oracle.com> Mainline commit 631d1febab8e546e3bb800bdfe2c212b8adf87de added configfs_depend_item() and configfs_undepend_item(). Patch adds empty macros when building against EL5 that does not have the functionality. Signed-off-by: Sunil Mushran --- Makefile | 3 ++- configure.in | 5 +++++ kapi-compat/include/configfs.h | 7 +++++++ 3 files changed, 14 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/configfs.h diff --git a/Makefile b/Makefile index 5e1bb62..00535ff 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/sysctl.h \ kapi-compat/include/slab.h \ kapi-compat/include/blkdev_put.h \ - kapi-compat/include/blkdev_get.h + kapi-compat/include/blkdev_get.h \ + kapi-compat/include/configfs.h PATCH_FILES = diff --git a/configure.in b/configure.in index 8ce5e67..aad0ea1 100644 --- a/configure.in +++ b/configure.in @@ -349,6 +349,11 @@ OCFS2_CHECK_KERNEL([ older prototype of blkdev_get() in fs.h], fs.h, blkdev_get_header=blkdev_get.h, , [^extern int blkdev_get(struct block_device \*, mode_t, unsigned);]) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $blkdev_get_header" +configfs_compat_header= +OCFS2_CHECK_KERNEL([configfs_depend_item() in configfs.h], configfs.h, + , configfs_compat_header=configfs.h, [^int configfs_depend_item(]) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $configfs_compat_header" + # End kapi_compat checks # using -include has two advantages: diff --git a/kapi-compat/include/configfs.h b/kapi-compat/include/configfs.h new file mode 100644 index 0000000..cbc11e6 --- /dev/null +++ b/kapi-compat/include/configfs.h @@ -0,0 +1,7 @@ +#ifndef KAPI_CONFIGFS_H +#define KAPI_CONFIGFS_H + +#define configfs_depend_item(a, b) (0) +#define configfs_undepend_item(a, b) + +#endif -- 1.5.6.5 From sunil.mushran at oracle.com Thu Nov 12 17:47:36 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Thu, 12 Nov 2009 17:47:36 -0800 Subject: [Ocfs2-devel] [PATCH 15/18] ocfs2: Handle missing export should_remove_suid() In-Reply-To: <1258076859-13538-1-git-send-email-sunil.mushran@oracle.com> References: <1258076859-13538-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1258076859-13538-16-git-send-email-sunil.mushran@oracle.com> Mainline commit d23a147bb6e8d467e8df73b6589888717da3b9ce exported the symbol should_remove_suid(). Patch adds compat_should_remove_suid.c that includes the same function that gets built when building with EL5. Signed-off-by: Sunil Mushran --- Config.make.in | 1 + Makefile | 3 +- configure.in | 10 +++++++ fs/ocfs2/Makefile | 6 ++++ fs/ocfs2/compat_should_remove_suid.c | 40 ++++++++++++++++++++++++++++++ kapi-compat/include/should_remove_suid.h | 12 +++++++++ 6 files changed, 71 insertions(+), 1 deletions(-) create mode 100644 fs/ocfs2/compat_should_remove_suid.c create mode 100644 kapi-compat/include/should_remove_suid.h diff --git a/Config.make.in b/Config.make.in index 355bf2a..4b5f4c3 100644 --- a/Config.make.in +++ b/Config.make.in @@ -76,6 +76,7 @@ KMEM_CACHE_CREATE_DTOR = @KMEM_CACHE_CREATE_DTOR@ OLD_BIO_END_IO_T = @OLD_BIO_END_IO_T@ NO_FAULT_IN_VMOPS = @NO_FAULT_IN_VMOPS@ GET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN = @GET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN@ +NO_SHOULD_REMOVE_SUID = @NO_SHOULD_REMOVE_SUID@ OCFS_DEBUG = @OCFS_DEBUG@ diff --git a/Makefile b/Makefile index 898879d..8536d51 100644 --- a/Makefile +++ b/Makefile @@ -32,7 +32,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/sock_shutdown.h \ kapi-compat/include/bdi_init.h \ kapi-compat/include/bdi_define.h \ - kapi-compat/include/inode_permission.h + kapi-compat/include/inode_permission.h \ + kapi-compat/include/should_remove_suid.h PATCH_FILES = diff --git a/configure.in b/configure.in index b8f1bd8..3b8fd4e 100644 --- a/configure.in +++ b/configure.in @@ -389,6 +389,16 @@ OCFS2_CHECK_KERNEL([ get() return u64 in simple_attr_open() in fs.h], fs.h, GET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN=yes, , [u64 (\*get)(void \*), void (\*set)(void \*, u64),]) AC_SUBST(GET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN) +NO_SHOULD_REMOVE_SUID= +AC_MSG_CHECKING(for including should_remove_suid()) +AC_ARG_ENABLE(srsuid, [ --enable-srsuid=[yes/no] Include should_remove_suid() [default=yes]],,enable_srsuid=yes) +if test "x$enable_srsuid" = "xyes"; then + NO_SHOULD_REMOVE_SUID=yes + KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS should_remove_suid.h" +fi +AC_SUBST(NO_SHOULD_REMOVE_SUID) +AC_MSG_RESULT($enable_srsuid) + # End kapi_compat checks # using -include has two advantages: diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile index 6960f40..4a4c250 100644 --- a/fs/ocfs2/Makefile +++ b/fs/ocfs2/Makefile @@ -104,6 +104,12 @@ ifdef GET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN EXTRA_CFLAGS += -DGET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN endif +COMPAT_SOURCES += compat_should_remove_suid.c +ifdef NO_SHOULD_REMOVE_SUID +FS_SOURCES += compat_should_remove_suid.c +EXTRA_CFLAGS += -DNO_SHOULD_REMOVE_SUID +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes. diff --git a/fs/ocfs2/compat_should_remove_suid.c b/fs/ocfs2/compat_should_remove_suid.c new file mode 100644 index 0000000..6b4fdc7 --- /dev/null +++ b/fs/ocfs2/compat_should_remove_suid.c @@ -0,0 +1,40 @@ +/* + * compat_should_remove_suid.c + * + * This code has been copied from mainline linux kernel git commit + * e7b34019606ab1dd06196635e931b0c302799228 to allow ocfs2 to build + * against older kernels. For license, refer to mm/filemap.c in mainline + * linux kernel. + * + */ + +#include +#include + +/* + * The logic we want is + * + * if suid or (sgid and xgrp) + * remove privs + */ +int should_remove_suid(struct dentry *dentry) +{ + mode_t mode = dentry->d_inode->i_mode; + int kill = 0; + + /* suid always must be killed */ + if (unlikely(mode & S_ISUID)) + kill = ATTR_KILL_SUID; + + /* + * sgid without any exec bits is just a mandatory locking mark; leave + * it alone. If some exec bits are set, it's a real sgid; kill it. + */ + if (unlikely((mode & S_ISGID) && (mode & S_IXGRP))) + kill |= ATTR_KILL_SGID; + + if (unlikely(kill && !capable(CAP_FSETID))) + return kill; + + return 0; +} diff --git a/kapi-compat/include/should_remove_suid.h b/kapi-compat/include/should_remove_suid.h new file mode 100644 index 0000000..8491125 --- /dev/null +++ b/kapi-compat/include/should_remove_suid.h @@ -0,0 +1,12 @@ +#ifndef KAPI_SHOULD_REMOVE_SUID_H +#define KAPI_SHOULD_REMOVE_SUID_H + +#ifdef NO_SHOULD_REMOVE_SUID + +#include + +int should_remove_suid(struct dentry *dentry); + +#endif + +#endif -- 1.5.6.5 From sunil.mushran at oracle.com Thu Nov 12 17:47:29 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Thu, 12 Nov 2009 17:47:29 -0800 Subject: [Ocfs2-devel] [PATCH 08/18] ocfs2: Handle missing mutex in struct configfs_subsystem In-Reply-To: <1258076859-13538-1-git-send-email-sunil.mushran@oracle.com> References: <1258076859-13538-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1258076859-13538-9-git-send-email-sunil.mushran@oracle.com> Mainline commit e6bd07aee739566803425acdbf5cdb29919164e1 changed a semaphore (su_sem) into a mutex (su_mutex) in struct configfs_subsystem. Patch adds macros to allow building with EL5. Signed-off-by: Sunil Mushran --- Makefile | 3 ++- configure.in | 5 +++++ fs/ocfs2/cluster/kapi-default.h | 5 +++++ fs/ocfs2/cluster/nodemanager.c | 2 +- kapi-compat/include/su_mutex.h | 9 +++++++++ 5 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 kapi-compat/include/su_mutex.h diff --git a/Makefile b/Makefile index 00535ff..623bda4 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/slab.h \ kapi-compat/include/blkdev_put.h \ kapi-compat/include/blkdev_get.h \ - kapi-compat/include/configfs.h + kapi-compat/include/configfs.h \ + kapi-compat/include/su_mutex.h PATCH_FILES = diff --git a/configure.in b/configure.in index aad0ea1..af32060 100644 --- a/configure.in +++ b/configure.in @@ -354,6 +354,11 @@ OCFS2_CHECK_KERNEL([configfs_depend_item() in configfs.h], configfs.h, , configfs_compat_header=configfs.h, [^int configfs_depend_item(]) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $configfs_compat_header" +su_mutex_header= +OCFS2_CHECK_KERNEL([su_mutex in struct configfs_subsystem in configfs.h], configfs.h, + , su_mutex_header=su_mutex.h, [struct mutex su_mutex;]) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $su_mutex_header" + # End kapi_compat checks # using -include has two advantages: diff --git a/fs/ocfs2/cluster/kapi-default.h b/fs/ocfs2/cluster/kapi-default.h index fc3da05..81dce2f 100644 --- a/fs/ocfs2/cluster/kapi-default.h +++ b/fs/ocfs2/cluster/kapi-default.h @@ -37,4 +37,9 @@ typedef struct work_struct kapi_work_struct_t; # define kapi_blkdev_get blkdev_get #endif +#ifndef kapi_mutex_init +# define kapi_mutex_init mutex_init +# define su_mutex su_mutex +#endif + #endif diff --git a/fs/ocfs2/cluster/nodemanager.c b/fs/ocfs2/cluster/nodemanager.c index 7ee6188..31140df 100644 --- a/fs/ocfs2/cluster/nodemanager.c +++ b/fs/ocfs2/cluster/nodemanager.c @@ -903,7 +903,7 @@ static int __init init_o2nm(void) goto out_o2net; config_group_init(&o2nm_cluster_group.cs_subsys.su_group); - mutex_init(&o2nm_cluster_group.cs_subsys.su_mutex); + kapi_mutex_init(&o2nm_cluster_group.cs_subsys.su_mutex); ret = configfs_register_subsystem(&o2nm_cluster_group.cs_subsys); if (ret) { printk(KERN_ERR "nodemanager: Registration returned %d\n", ret); diff --git a/kapi-compat/include/su_mutex.h b/kapi-compat/include/su_mutex.h new file mode 100644 index 0000000..6713348 --- /dev/null +++ b/kapi-compat/include/su_mutex.h @@ -0,0 +1,9 @@ +#ifndef KAPI_SUMUTEX_H +#define KAPI_SUMUTEX_H + +#include "asm/semaphore.h" + +#define kapi_mutex_init init_MUTEX +#define su_mutex su_sem + +#endif -- 1.5.6.5 From sunil.mushran at oracle.com Thu Nov 12 17:47:35 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Thu, 12 Nov 2009 17:47:35 -0800 Subject: [Ocfs2-devel] [PATCH 14/18] ocfs2: Handle older prototype of simple attribute get() In-Reply-To: <1258076859-13538-1-git-send-email-sunil.mushran@oracle.com> References: <1258076859-13538-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1258076859-13538-15-git-send-email-sunil.mushran@oracle.com> Mainline commit 8b88b0998e35d239e74446cc30f354bdab86df89 changed prototype of simple attribute get() by returning the value via an argument. Patch detects older kernels and uses the older prototype that just return(ed) the value. Signed-off-by: Sunil Mushran --- Config.make.in | 1 + configure.in | 5 +++++ fs/ocfs2/Makefile | 4 ++++ fs/ocfs2/blockcheck.c | 8 ++++++++ 4 files changed, 18 insertions(+), 0 deletions(-) diff --git a/Config.make.in b/Config.make.in index a0330b9..355bf2a 100644 --- a/Config.make.in +++ b/Config.make.in @@ -75,6 +75,7 @@ OLD_PERMISSION = @OLD_PERMISSION@ KMEM_CACHE_CREATE_DTOR = @KMEM_CACHE_CREATE_DTOR@ OLD_BIO_END_IO_T = @OLD_BIO_END_IO_T@ NO_FAULT_IN_VMOPS = @NO_FAULT_IN_VMOPS@ +GET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN = @GET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN@ OCFS_DEBUG = @OCFS_DEBUG@ diff --git a/configure.in b/configure.in index 56315a6..b8f1bd8 100644 --- a/configure.in +++ b/configure.in @@ -384,6 +384,11 @@ OCFS2_CHECK_KERNEL([inode_permision in fs.h], fs.h, , inode_permission_header=inode_permission.h, [^extern int inode_permission(struct inode \*]) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $inode_permission_header" +GET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN= +OCFS2_CHECK_KERNEL([ get() return u64 in simple_attr_open() in fs.h], fs.h, + GET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN=yes, , [u64 (\*get)(void \*), void (\*set)(void \*, u64),]) +AC_SUBST(GET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN) + # End kapi_compat checks # using -include has two advantages: diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile index 401a1f5..6960f40 100644 --- a/fs/ocfs2/Makefile +++ b/fs/ocfs2/Makefile @@ -100,6 +100,10 @@ ifdef NO_FAULT_IN_VMOPS EXTRA_CFLAGS += -DNO_FAULT_IN_VMOPS endif +ifdef GET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN +EXTRA_CFLAGS += -DGET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes. diff --git a/fs/ocfs2/blockcheck.c b/fs/ocfs2/blockcheck.c index a1163b8..4927bf9 100644 --- a/fs/ocfs2/blockcheck.c +++ b/fs/ocfs2/blockcheck.c @@ -232,11 +232,19 @@ void ocfs2_hamming_fix_block(void *data, unsigned int blocksize, #ifdef CONFIG_DEBUG_FS +#ifdef GET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN +static u64 blockcheck_u64_get(void *data) +{ + return *(u64 *)data; +} +#else static int blockcheck_u64_get(void *data, u64 *val) { *val = *(u64 *)data; return 0; } +#endif + DEFINE_SIMPLE_ATTRIBUTE(blockcheck_fops, blockcheck_u64_get, NULL, "%llu\n"); static struct dentry *blockcheck_debugfs_create(const char *name, -- 1.5.6.5 From sunil.mushran at oracle.com Thu Nov 12 17:47:30 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Thu, 12 Nov 2009 17:47:30 -0800 Subject: [Ocfs2-devel] [PATCH 09/18] ocfs2: Handle missing helper kernel_sock_shutdown() In-Reply-To: <1258076859-13538-1-git-send-email-sunil.mushran@oracle.com> References: <1258076859-13538-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1258076859-13538-10-git-send-email-sunil.mushran@oracle.com> Mainline commit 91cf45f02af5c871251165d000c3f42a2a0b0552 added helper kernel_sock_shutdown(). Signed-off-by: Sunil Mushran --- Makefile | 3 ++- configure.in | 5 +++++ kapi-compat/include/sock_shutdown.h | 17 +++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/sock_shutdown.h diff --git a/Makefile b/Makefile index 623bda4..0dd7443 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/blkdev_put.h \ kapi-compat/include/blkdev_get.h \ kapi-compat/include/configfs.h \ - kapi-compat/include/su_mutex.h + kapi-compat/include/su_mutex.h \ + kapi-compat/include/sock_shutdown.h PATCH_FILES = diff --git a/configure.in b/configure.in index af32060..e045fa8 100644 --- a/configure.in +++ b/configure.in @@ -359,6 +359,11 @@ OCFS2_CHECK_KERNEL([su_mutex in struct configfs_subsystem in configfs.h], config , su_mutex_header=su_mutex.h, [struct mutex su_mutex;]) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $su_mutex_header" +sock_shutdown_header= +OCFS2_CHECK_KERNEL([kernel_sock_shutdown() in net.t], net.h, + , sock_shutdown_header=sock_shutdown.h, [^extern int kernel_sock_shutdown(struct socket \*sock]) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $sock_shutdown_header" + # End kapi_compat checks # using -include has two advantages: diff --git a/kapi-compat/include/sock_shutdown.h b/kapi-compat/include/sock_shutdown.h new file mode 100644 index 0000000..83efccd --- /dev/null +++ b/kapi-compat/include/sock_shutdown.h @@ -0,0 +1,17 @@ +#ifndef KAPI_SOCK_SHUTDOWN_H +#define KAPI_SOCK_SHUTDOWN_H + +#include + +enum sock_shutdown_cmd { + SHUT_RD = 0, + SHUT_WR = 1, + SHUT_RDWR = 2, +}; + +static inline int kernel_sock_shutdown(struct socket *sock, enum sock_shutdown_cmd how) +{ + return sock->ops->shutdown(sock, how); +} + +#endif -- 1.5.6.5 From sunil.mushran at oracle.com Thu Nov 12 17:47:34 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Thu, 12 Nov 2009 17:47:34 -0800 Subject: [Ocfs2-devel] [PATCH 13/18] ocfs2: Handle missing inode_permission() In-Reply-To: <1258076859-13538-1-git-send-email-sunil.mushran@oracle.com> References: <1258076859-13538-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1258076859-13538-14-git-send-email-sunil.mushran@oracle.com> Mainline commit f419a2e3b64def707e1384ee38abb77f99af5f6d renamed permission() to inode_permission(). Patch uses an inline to redirect inode_permission() to permission() when building with EL5. Signed-off-by: Sunil Mushran --- Makefile | 3 ++- configure.in | 5 +++++ kapi-compat/include/inode_permission.h | 11 +++++++++++ 3 files changed, 18 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/inode_permission.h diff --git a/Makefile b/Makefile index 1cd2584..898879d 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/su_mutex.h \ kapi-compat/include/sock_shutdown.h \ kapi-compat/include/bdi_init.h \ - kapi-compat/include/bdi_define.h + kapi-compat/include/bdi_define.h \ + kapi-compat/include/inode_permission.h PATCH_FILES = diff --git a/configure.in b/configure.in index a65ba15..56315a6 100644 --- a/configure.in +++ b/configure.in @@ -379,6 +379,11 @@ OCFS2_CHECK_KERNEL([fault() in struct vm_operations_struct in mm.h], mm.h, , NO_FAULT_IN_VMOPS=yes, [^.*int (\*fault)]) AC_SUBST(NO_FAULT_IN_VMOPS) +inode_permission_header= +OCFS2_CHECK_KERNEL([inode_permision in fs.h], fs.h, + , inode_permission_header=inode_permission.h, [^extern int inode_permission(struct inode \*]) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $inode_permission_header" + # End kapi_compat checks # using -include has two advantages: diff --git a/kapi-compat/include/inode_permission.h b/kapi-compat/include/inode_permission.h new file mode 100644 index 0000000..43f80d3 --- /dev/null +++ b/kapi-compat/include/inode_permission.h @@ -0,0 +1,11 @@ +#ifndef INODE_PERMISSION_H +#define INODE_PERMISSION_H + +#include + +static inline int inode_permission(struct inode *inode, int flags) +{ + return permission(inode, flags, NULL); +} + +#endif -- 1.5.6.5 From sunil.mushran at oracle.com Thu Nov 12 17:47:33 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Thu, 12 Nov 2009 17:47:33 -0800 Subject: [Ocfs2-devel] [PATCH 12/18] ocfs2: Handle missing vmops->fault() In-Reply-To: <1258076859-13538-1-git-send-email-sunil.mushran@oracle.com> References: <1258076859-13538-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1258076859-13538-13-git-send-email-sunil.mushran@oracle.com> Mainline commit 54cb8821de07f2ffcd28c380ce9b93d5784b40d7 introduced vmops->fault() to replace vmops->populate() and vmops->nopage(). Patch adds nopage() and uses it when building against EL5. Signed-off-by: Sunil Mushran --- Config.make.in | 1 + configure.in | 5 ++++ fs/ocfs2/Makefile | 4 +++ fs/ocfs2/mmap.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 65 insertions(+), 1 deletions(-) diff --git a/Config.make.in b/Config.make.in index 618c814..a0330b9 100644 --- a/Config.make.in +++ b/Config.make.in @@ -74,6 +74,7 @@ NO_VECTORIZED_AIO = @NO_VECTORIZED_AIO@ OLD_PERMISSION = @OLD_PERMISSION@ KMEM_CACHE_CREATE_DTOR = @KMEM_CACHE_CREATE_DTOR@ OLD_BIO_END_IO_T = @OLD_BIO_END_IO_T@ +NO_FAULT_IN_VMOPS = @NO_FAULT_IN_VMOPS@ OCFS_DEBUG = @OCFS_DEBUG@ diff --git a/configure.in b/configure.in index 5fe4934..a65ba15 100644 --- a/configure.in +++ b/configure.in @@ -374,6 +374,11 @@ OCFS2_CHECK_KERNEL([BDI_CAP_NO_ACCT_AND_WRITEBACK in backing-dev.h], backing-dev , bdi_define_compat_header=bdi_define.h, [^#define BDI_CAP_NO_ACCT_AND_WRITEBACK]) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $bdi_define_compat_header" +NO_FAULT_IN_VMOPS= +OCFS2_CHECK_KERNEL([fault() in struct vm_operations_struct in mm.h], mm.h, + , NO_FAULT_IN_VMOPS=yes, [^.*int (\*fault)]) +AC_SUBST(NO_FAULT_IN_VMOPS) + # End kapi_compat checks # using -include has two advantages: diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile index c769fd8..401a1f5 100644 --- a/fs/ocfs2/Makefile +++ b/fs/ocfs2/Makefile @@ -96,6 +96,10 @@ ifdef KMEM_CACHE_CREATE_DTOR EXTRA_CFLAGS += -DKMEM_CACHE_CREATE_DTOR endif +ifdef NO_FAULT_IN_VMOPS +EXTRA_CFLAGS += -DNO_FAULT_IN_VMOPS +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes. diff --git a/fs/ocfs2/mmap.c b/fs/ocfs2/mmap.c index b4a25c8..4d37071 100644 --- a/fs/ocfs2/mmap.c +++ b/fs/ocfs2/mmap.c @@ -60,6 +60,7 @@ static inline int ocfs2_vm_op_unblock_sigs(sigset_t *oldset) return sigprocmask(SIG_SETMASK, oldset, NULL); } +#ifndef NO_FAULT_IN_VMOPS static int ocfs2_fault(struct vm_area_struct *area, struct vm_fault *vmf) { sigset_t blocked, oldset; @@ -83,6 +84,35 @@ out: mlog_exit_ptr(vmf->page); return ret; } +#else +static struct page *ocfs2_nopage(struct vm_area_struct * area, + unsigned long address, + int *type) +{ + struct page *page = NOPAGE_SIGBUS; + sigset_t blocked, oldset; + int error, ret; + + mlog_entry("(area=%p, address=%lu, type=%p)\n", area, address, + type); + + error = ocfs2_vm_op_block_sigs(&blocked, &oldset); + if (error < 0) { + mlog_errno(error); + ret = VM_FAULT_SIGBUS; + goto out; + } + + page = filemap_nopage(area, address, type); + + error = ocfs2_vm_op_unblock_sigs(&oldset); + if (error < 0) + mlog_errno(error); +out: + mlog_exit_ptr(page); + return page; +} +#endif static int __ocfs2_page_mkwrite(struct inode *inode, struct buffer_head *di_bh, struct page *page) @@ -96,6 +126,9 @@ static int __ocfs2_page_mkwrite(struct inode *inode, struct buffer_head *di_bh, void *fsdata; loff_t size = i_size_read(inode); + mlog_entry("(inode=0x%p, i_ino=%lu, page=0x%p)\n", inode, inode->i_ino, + page); + /* * Another node might have truncated while we were waiting on * cluster locks. @@ -151,17 +184,26 @@ static int __ocfs2_page_mkwrite(struct inode *inode, struct buffer_head *di_bh, BUG_ON(ret != len); ret = 0; out: + mlog_exit(ret); return ret; } +#ifndef NO_FAULT_IN_VMOPS static int ocfs2_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) +#else +static int ocfs2_page_mkwrite(struct vm_area_struct *vma, struct page *page) +#endif { +#ifndef NO_FAULT_IN_VMOPS struct page *page = vmf->page; +#endif struct inode *inode = filp_dentry(vma->vm_file)->d_inode; struct buffer_head *di_bh = NULL; sigset_t blocked, oldset; int ret, ret2; + mlog_entry("(vma=0x%p, page=0x%p)\n", vma, page); + ret = ocfs2_vm_op_block_sigs(&blocked, &oldset); if (ret < 0) { mlog_errno(ret); @@ -199,6 +241,7 @@ out: mlog_errno(ret2); if (ret) ret = VM_FAULT_SIGBUS; + mlog_exit(ret); return ret; } @@ -207,7 +250,11 @@ static struct vm_operations_struct ocfs2_file_vm_ops = { #else static const struct vm_operations_struct ocfs2_file_vm_ops = { #endif +#ifndef NO_FAULT_IN_VMOPS .fault = ocfs2_fault, +#else + .nopage = ocfs2_nopage, +#endif .page_mkwrite = ocfs2_page_mkwrite, }; @@ -215,6 +262,10 @@ int ocfs2_mmap(struct file *file, struct vm_area_struct *vma) { int ret = 0, lock_level = 0; + mlog_entry("(file=0x%p, vma=%p, '%.*s')\n", file, vma, + filp_dentry(file)->d_name.len, + filp_dentry(file)->d_name.name); + ret = ocfs2_inode_lock_atime(filp_dentry(file)->d_inode, filp_mnt(file), &lock_level); if (ret < 0) { @@ -224,7 +275,10 @@ int ocfs2_mmap(struct file *file, struct vm_area_struct *vma) ocfs2_inode_unlock(filp_dentry(file)->d_inode, lock_level); out: vma->vm_ops = &ocfs2_file_vm_ops; +#ifndef NO_FAULT_IN_VMOPS vma->vm_flags |= VM_CAN_NONLINEAR; - return 0; +#endif + mlog_exit(ret); + return ret; } -- 1.5.6.5 From sunil.mushran at oracle.com Thu Nov 12 17:47:32 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Thu, 12 Nov 2009 17:47:32 -0800 Subject: [Ocfs2-devel] [PATCH 11/18] ocfs2: Handle missing BDI_CAP_NO_ACCT_AND_WRITEBACK In-Reply-To: <1258076859-13538-1-git-send-email-sunil.mushran@oracle.com> References: <1258076859-13538-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1258076859-13538-12-git-send-email-sunil.mushran@oracle.com> Mainline commit e4ad08fe64afca4ef79ecc4c624e6e871688da0d added macro BDI_CAP_NO_ACCT_AND_WRITEBACK. Signed-off-by: Sunil Mushran --- Makefile | 3 ++- configure.in | 5 +++++ kapi-compat/include/bdi_define.h | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/bdi_define.h diff --git a/Makefile b/Makefile index 68f746e..1cd2584 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/configfs.h \ kapi-compat/include/su_mutex.h \ kapi-compat/include/sock_shutdown.h \ - kapi-compat/include/bdi_init.h + kapi-compat/include/bdi_init.h \ + kapi-compat/include/bdi_define.h PATCH_FILES = diff --git a/configure.in b/configure.in index 53deffd..5fe4934 100644 --- a/configure.in +++ b/configure.in @@ -369,6 +369,11 @@ OCFS2_CHECK_KERNEL([bdi_init() in backing-dev.h], backing-dev.h, , bdi_init_compat_header=bdi_init.h, [^int bdi_init(struct backing_dev_info \*bdi);]) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $bdi_init_compat_header" +bdi_define_compat_header= +OCFS2_CHECK_KERNEL([BDI_CAP_NO_ACCT_AND_WRITEBACK in backing-dev.h], backing-dev.h, + , bdi_define_compat_header=bdi_define.h, [^#define BDI_CAP_NO_ACCT_AND_WRITEBACK]) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $bdi_define_compat_header" + # End kapi_compat checks # using -include has two advantages: diff --git a/kapi-compat/include/bdi_define.h b/kapi-compat/include/bdi_define.h new file mode 100644 index 0000000..28de9da --- /dev/null +++ b/kapi-compat/include/bdi_define.h @@ -0,0 +1,6 @@ +#ifndef KAPI_BDI_DEFINE_H +#define KAPI_BDI_DEFINE_H + +#define BDI_CAP_NO_ACCT_AND_WRITEBACK (BDI_CAP_NO_ACCT_DIRTY | BDI_CAP_NO_WRITEBACK) + +#endif -- 1.5.6.5 From sunil.mushran at oracle.com Thu Nov 12 17:47:25 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Thu, 12 Nov 2009 17:47:25 -0800 Subject: [Ocfs2-devel] [PATCH 04/18] ocfs2/cluster: Handle different prototype of bi_end_io_t In-Reply-To: <1258076859-13538-1-git-send-email-sunil.mushran@oracle.com> References: <1258076859-13538-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1258076859-13538-5-git-send-email-sunil.mushran@oracle.com> Mainline commit 6712ecf8f648118c3363c142196418f89a510b90 dropped the 'size' argument from bi_end_io_t. Also changed the return from int to void. Patch uses the older prototype when building with EL5 kernels. Signed-off-by: Sunil Mushran --- Config.make.in | 1 + configure.in | 5 +++++ fs/ocfs2/cluster/Makefile | 4 ++++ fs/ocfs2/cluster/heartbeat.c | 7 +++++++ 4 files changed, 17 insertions(+), 0 deletions(-) diff --git a/Config.make.in b/Config.make.in index fb705b5..618c814 100644 --- a/Config.make.in +++ b/Config.make.in @@ -73,6 +73,7 @@ SEQOP_IS_NOT_CONST = @SEQOP_IS_NOT_CONST@ NO_VECTORIZED_AIO = @NO_VECTORIZED_AIO@ OLD_PERMISSION = @OLD_PERMISSION@ KMEM_CACHE_CREATE_DTOR = @KMEM_CACHE_CREATE_DTOR@ +OLD_BIO_END_IO_T = @OLD_BIO_END_IO_T@ OCFS_DEBUG = @OCFS_DEBUG@ diff --git a/configure.in b/configure.in index 98cdc5d..8696935 100644 --- a/configure.in +++ b/configure.in @@ -334,6 +334,11 @@ OCFS2_CHECK_KERNEL([ older prototype of kmem_cache_create() in slab.h], slab.h, AC_SUBST(KMEM_CACHE_CREATE_DTOR) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $KMEM_CACHE_CREATE_DTOR" +OLD_BIO_END_IO_T= +OCFS2_CHECK_KERNEL([ older prototype of bio_end_io_t in bio.h], bio.h, + OLD_BIO_END_IO_T=yes, , [^typedef int (bio_end_io_t) (struct bio \*, unsigned int, int);]) +AC_SUBST(OLD_BIO_END_IO_T) + # End kapi_compat checks # using -include has two advantages: diff --git a/fs/ocfs2/cluster/Makefile b/fs/ocfs2/cluster/Makefile index 1f040c6..d107cca 100644 --- a/fs/ocfs2/cluster/Makefile +++ b/fs/ocfs2/cluster/Makefile @@ -26,6 +26,10 @@ ifdef SEQOP_IS_NOT_CONST EXTRA_CFLAGS += -DSEQOP_IS_NOT_CONST endif +ifdef OLD_BIO_END_IO_T +EXTRA_CFLAGS += -DOLD_BIO_END_IO_T +endif + SOURCES += \ heartbeat.c \ masklog.c \ diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c index 68e9af5..d07241f 100644 --- a/fs/ocfs2/cluster/heartbeat.c +++ b/fs/ocfs2/cluster/heartbeat.c @@ -221,7 +221,11 @@ static void o2hb_wait_on_io(struct o2hb_region *reg, wait_for_completion(&wc->wc_io_complete); } +#ifdef OLD_BIO_END_IO_T +static int o2hb_bio_end_io(struct bio *bio, unsigned int size, +#else static void o2hb_bio_end_io(struct bio *bio, +#endif int error) { struct o2hb_bio_wait_ctxt *wc = bio->bi_private; @@ -233,6 +237,9 @@ static void o2hb_bio_end_io(struct bio *bio, o2hb_bio_wait_dec(wc, 1); bio_put(bio); +#ifdef OLD_BIO_END_IO_T + return 0; +#endif } /* Setup a Bio to cover I/O against num_slots slots starting at -- 1.5.6.5 From sunil.mushran at oracle.com Thu Nov 12 17:47:21 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Thu, 12 Nov 2009 17:47:21 -0800 Subject: [Ocfs2-devel] ocfs2-1.6 - fifth set Message-ID: <1258076859-13538-1-git-send-email-sunil.mushran@oracle.com> The next set. All patches prior to this have been pushed to the repo. From sunil.mushran at oracle.com Thu Nov 12 17:47:23 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Thu, 12 Nov 2009 17:47:23 -0800 Subject: [Ocfs2-devel] [PATCH 02/18] ocfs2: Add KAPI_INIT_WORK macro in kapi-default.h In-Reply-To: <1258076859-13538-1-git-send-email-sunil.mushran@oracle.com> References: <1258076859-13538-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1258076859-13538-3-git-send-email-sunil.mushran@oracle.com> Commit dbc80b8f391820b719db97004219327c8cf050bc added KAPI_INIT_WORK macros to fs/ocfs2/kapi-default.h. This patch adds the same to the same header in dlm and cluster sub-directories. Signed-off-by: Sunil Mushran --- fs/ocfs2/cluster/kapi-default.h | 6 ++++++ fs/ocfs2/dlm/kapi-default.h | 6 ++++++ 2 files changed, 12 insertions(+), 0 deletions(-) diff --git a/fs/ocfs2/cluster/kapi-default.h b/fs/ocfs2/cluster/kapi-default.h index fcf3ac9..21e5e3a 100644 --- a/fs/ocfs2/cluster/kapi-default.h +++ b/fs/ocfs2/cluster/kapi-default.h @@ -22,5 +22,11 @@ #ifndef KAPI_DEFAULT_H #define KAPI_DEFAULT_H +#ifndef KAPI_INIT_WORK +typedef struct work_struct kapi_work_struct_t; +# define work_to_object(a, b, c) container_of(a, b, c) +# define KAPI_INIT_WORK(a, b, c) INIT_WORK(a, b) +# define KAPI_INIT_DELAYED_WORK(a, b, c) INIT_DELAYED_WORK(a, b) +#endif #endif diff --git a/fs/ocfs2/dlm/kapi-default.h b/fs/ocfs2/dlm/kapi-default.h index fcf3ac9..21e5e3a 100644 --- a/fs/ocfs2/dlm/kapi-default.h +++ b/fs/ocfs2/dlm/kapi-default.h @@ -22,5 +22,11 @@ #ifndef KAPI_DEFAULT_H #define KAPI_DEFAULT_H +#ifndef KAPI_INIT_WORK +typedef struct work_struct kapi_work_struct_t; +# define work_to_object(a, b, c) container_of(a, b, c) +# define KAPI_INIT_WORK(a, b, c) INIT_WORK(a, b) +# define KAPI_INIT_DELAYED_WORK(a, b, c) INIT_DELAYED_WORK(a, b) +#endif #endif -- 1.5.6.5 From Joel.Becker at oracle.com Thu Nov 12 18:17:53 2009 From: Joel.Becker at oracle.com (Joel Becker) Date: Thu, 12 Nov 2009 18:17:53 -0800 Subject: [Ocfs2-devel] [PATCH 03/18] ocfs2: Handle missing dtor in kmem_cache_create() In-Reply-To: <1258076859-13538-4-git-send-email-sunil.mushran@oracle.com> References: <1258076859-13538-1-git-send-email-sunil.mushran@oracle.com> <1258076859-13538-4-git-send-email-sunil.mushran@oracle.com> Message-ID: <20091113021753.GA21197@mail.oracle.com> On Thu, Nov 12, 2009 at 05:47:24PM -0800, Sunil Mushran wrote: > Mainline commit 20c2df83d25c6a95affe6157a4c9cac4cf5ffaac removed the > dtor arg from kmem_cache_create(). Patch adds a kapi macro that adds > a dtor arg when building against EL5 kernels. Question: Do you want to support an assortment of mainline kernels, or only "2.6.32" and "2.6.18-el"? Because there are a number of slab things that happened. I'm not sure which all apply to el5 anymore. Not only did the destructor go away, so did the flag SLAB_CTOR_VERIFY, and the init_once constructors changed prototype. Here was my solution: http://oss.oracle.com/git/oracleasm.git/?p=oracleasm.git;a=commit;h=0888fd1be3d15ab3c7f504c8969c101f7d5d39fd (Note that there are a couple of later commits to fix typos) Joel -- Life's Little Instruction Book #182 "Be romantic." Joel Becker Principal Software Developer Oracle E-mail: joel.becker at oracle.com Phone: (650) 506-8127 From Joel.Becker at oracle.com Thu Nov 12 18:27:28 2009 From: Joel.Becker at oracle.com (Joel Becker) Date: Thu, 12 Nov 2009 18:27:28 -0800 Subject: [Ocfs2-devel] [PATCH 17/18] ocfs2: Handle missing filemap_fdatawait_range() In-Reply-To: <1258076859-13538-18-git-send-email-sunil.mushran@oracle.com> References: <1258076859-13538-1-git-send-email-sunil.mushran@oracle.com> <1258076859-13538-18-git-send-email-sunil.mushran@oracle.com> Message-ID: <20091113022727.GB21197@mail.oracle.com> On Thu, Nov 12, 2009 at 05:47:38PM -0800, Sunil Mushran wrote: > Mainline commit 918941a3f3d46c2a69971b4718aaf13b1be2f1a7 replaced > generic_file_aio_write_nolock() with __generic_file_aio_write() > and made use of helpers filemap_fdatawrite_range() and filemap_fdatawait_range(). > > Patch adds macros to allow building with current and older EL5 kernels. Ok, if I remember correctly, the old generic_file_aio_write_nlock() would do the sync work for us. Please add a comment in filemap_fdatawait_range.h about this so people don't worry that the define becomes 0. Joel -- "Drake! We're LEAVING!" Joel Becker Principal Software Developer Oracle E-mail: joel.becker at oracle.com Phone: (650) 506-8127 From sunil.mushran at oracle.com Thu Nov 12 18:37:01 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Thu, 12 Nov 2009 18:37:01 -0800 Subject: [Ocfs2-devel] [PATCH 03/18] ocfs2: Handle missing dtor in kmem_cache_create() In-Reply-To: <20091113021753.GA21197@mail.oracle.com> References: <1258076859-13538-1-git-send-email-sunil.mushran@oracle.com> <1258076859-13538-4-git-send-email-sunil.mushran@oracle.com> <20091113021753.GA21197@mail.oracle.com> Message-ID: <4AFCC64D.9040102@oracle.com> Joel Becker wrote: > On Thu, Nov 12, 2009 at 05:47:24PM -0800, Sunil Mushran wrote: > >> Mainline commit 20c2df83d25c6a95affe6157a4c9cac4cf5ffaac removed the >> dtor arg from kmem_cache_create(). Patch adds a kapi macro that adds >> a dtor arg when building against EL5 kernels. >> > > Question: Do you want to support an assortment of mainline > kernels, or only "2.6.32" and "2.6.18-el"? Because there are a number > of slab things that happened. I'm not sure which all apply to el5 > anymore. Not only did the destructor go away, so did the flag > SLAB_CTOR_VERIFY, and the init_once constructors changed prototype. > Here was my solution: > > http://oss.oracle.com/git/oracleasm.git/?p=oracleasm.git;a=commit;h=0888fd1be3d15ab3c7f504c8969c101f7d5d39fd > > (Note that there are a couple of later commits to fix typos) > Only EL5 U4. The idea is to be able to able to build against 2.6.32. But we only support running against EL5 U4. From mingo at elte.hu Thu Nov 12 23:53:06 2009 From: mingo at elte.hu (Ingo Molnar) Date: Fri, 13 Nov 2009 08:53:06 +0100 Subject: [Ocfs2-devel] [patch] Fix: 'return -ENOMEM' instead of 'return ENOMEM' In-Reply-To: <20091112202728.GC22985@mail.oracle.com> References: <4AFB2C0B.50605@gmail.com> <20091111134730.a0da9e38.akpm@linux-foundation.org> <20091112081043.GA25345@elte.hu> <20091112191758.GA22985@mail.oracle.com> <20091112202728.GC22985@mail.oracle.com> Message-ID: <20091113075306.GB2775@elte.hu> * Joel Becker wrote: > On Thu, Nov 12, 2009 at 11:17:58AM -0800, Joel Becker wrote: > > On Thu, Nov 12, 2009 at 09:10:43AM +0100, Ingo Molnar wrote: > > > 5 out of 8 places look buggy - i.e. more than 60% - a checkpatch warning > > > would avoid real bugs here. (even ignoring the cleanliness effects of > > > using proper error propagation) > > > > > > Cc:-ed affected maintainers. The rightmost column are my observations. > > > Below is the patch fixing these. > > > > Acked-by: Joel Becker > > I take that back. NAK. > > Sorry, I read the code wrong. This function is just a handler. The > caller, dlm_send_begin_reco_message(), expects the positive EAGAIN as > a non-error case. Well, at minimum the error code usage is very confused. The dlm_begin_reco_handler gets registered via o2net_register_handler(). Here's where dlm_begin_reco_handler gets registered, followed by dlm_finalize_reco_handler right afterwards: status = o2net_register_handler(DLM_BEGIN_RECO_MSG, dlm->key, sizeof(struct dlm_begin_reco), dlm_begin_reco_handler, dlm, NULL, &dlm->dlm_domain_handlers); and right before that dlm_reco_data_done_handler() gets registered: status = o2net_register_handler(DLM_RECO_DATA_DONE_MSG, dlm->key, sizeof(struct dlm_reco_data_done), dlm_reco_data_done_handler, dlm, NULL, &dlm->dlm_domain_handlers); And look what dlm_reco_data_done_handler() starts with: int dlm_reco_data_done_handler(struct o2net_msg *msg, u32 len, void *data, void **ret_data) { struct dlm_ctxt *dlm = data; struct dlm_reco_data_done *done = (struct dlm_reco_data_done *)msg->buf; struct dlm_reco_node_data *ndata = NULL; int ret = -EINVAL; if (!dlm_grab(dlm)) return -EINVAL; A negative error code right there. The other event handlers are seem to be similar - dlm_begin_reco_handler() is the odd one out. So while you are right and my patch is wrong and DLM_BEGIN_RECO_MSG processing works right now - at minimum this is a very dangerous/fragile pattern of error code usage. For exampe if anyone uses dlm_begin_reco_handler() to implement a new state machine handler in the future, but uses one of the other event handlers to actually use it, a hard to find bug is introduced. Ingo From Joel.Becker at oracle.com Fri Nov 13 03:56:10 2009 From: Joel.Becker at oracle.com (Joel Becker) Date: Fri, 13 Nov 2009 03:56:10 -0800 Subject: [Ocfs2-devel] [patch] Fix: 'return -ENOMEM' instead of 'return ENOMEM' In-Reply-To: <20091113075306.GB2775@elte.hu> References: <4AFB2C0B.50605@gmail.com> <20091111134730.a0da9e38.akpm@linux-foundation.org> <20091112081043.GA25345@elte.hu> <20091112191758.GA22985@mail.oracle.com> <20091112202728.GC22985@mail.oracle.com> <20091113075306.GB2775@elte.hu> Message-ID: <20091113115610.GB28530@mail.oracle.com> On Fri, Nov 13, 2009 at 08:53:06AM +0100, Ingo Molnar wrote: > > Sorry, I read the code wrong. This function is just a handler. The > > caller, dlm_send_begin_reco_message(), expects the positive EAGAIN as > > a non-error case. > > Well, at minimum the error code usage is very confused. The > dlm_begin_reco_handler gets registered via o2net_register_handler(). > Here's where dlm_begin_reco_handler gets registered, followed by > dlm_finalize_reco_handler right afterwards: > A negative error code right there. The other event handlers are seem to > be similar - dlm_begin_reco_handler() is the odd one out. The usage of the handlers - 'status' is the return code of the handler - is pretty straightforward. Once you're in the mindset of the o2net code, of course. This is old stuff, from the earliest days of ocfs2 development, so we haven't had to spelunk in here for a while ;-) Sunil and I both thought while looking at this code that we could probably return -EAGAIN just as easily, though. We'll probably clean it that way at some point. Joel -- There are morethings in heaven and earth, Horatio, Than are dreamt of in your philosophy. Joel Becker Principal Software Developer Oracle E-mail: joel.becker at oracle.com Phone: (650) 506-8127 From giovanni at lsd.ufcg.edu.br Fri Nov 13 06:13:59 2009 From: giovanni at lsd.ufcg.edu.br (Giovanni Farias Silva) Date: Fri, 13 Nov 2009 11:13:59 -0300 Subject: [Ocfs2-devel] Research about distributed applications Message-ID: <4AFD69A7.4090408@lsd.ufcg.edu.br> Hi everyone, We are MSc. Candidates in Computer Science from COPIN-UFCG-Brazil and we are conducting a research where your collaboration is too important. Our objectives are: to understand how distributed applications are tested; and from this, we want to reach a way to allow a better testing practice for distributed applications. We found this project through a web search about distributed software. We would like that you answer a small questionnaire (link ), or you could forward this e-mail to the person which is more appropriate for answering it. All questions aim at discovering important aspects about tasks performed to test the software. We are not asking any information about project identification and you will not spend more than 3 minutes to answer the whole questionnaire. If you have already taken part in more than one distributed application project, please, answer the questionnaire once for each project. And, if you know anyone has already worked on, or are working on, a distributed software project, please, forward this e-mail to him/her. For more information, mail us. Thanks very much for your cooperation, Giovanni Farias - giovanni at lsd.ufcg.edu.br Alan Cruz - alan at lsd.ufcg.edu.br MsC Candidates at Federal University of Campina Grande - Brazil From joe.hoot at itec.suny.edu Fri Nov 13 08:27:08 2009 From: joe.hoot at itec.suny.edu (Hoot, Joseph) Date: Fri, 13 Nov 2009 11:27:08 -0500 Subject: [Ocfs2-devel] disable reboots when fencing Message-ID: What is the OCFS2 v1.4 equivalent to the OCFS2 v1.2 command to disable reboots upon fencing? echo 1 > /proc/fs/ocfs2_nodemanager/fence_method Thanks, Joe =========================== Joseph R. Hoot Lead System Programmer/Analyst (w) 716-878-4832 (c) 716-759-HOOT joe.hoot at itec.suny.edu GPG KEY: 7145F633 =========================== From sunil.mushran at oracle.com Fri Nov 13 12:32:31 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Fri, 13 Nov 2009 12:32:31 -0800 Subject: [Ocfs2-devel] disable reboots when fencing In-Reply-To: References: Message-ID: <4AFDC25F.7080909@oracle.com> That does not disable reboots. It merely changes the fence method panic. The default is a pci bus reset. We don't have it in 1.4 though we could add it back easily. The only use I see is if one needs to get a kernel coredump at the time of the fence. Hoot, Joseph wrote: > What is the OCFS2 v1.4 equivalent to the OCFS2 v1.2 command to disable reboots upon fencing? > > echo 1 > /proc/fs/ocfs2_nodemanager/fence_method > > Thanks, > Joe > > =========================== > Joseph R. Hoot > Lead System Programmer/Analyst > (w) 716-878-4832 > (c) 716-759-HOOT > joe.hoot at itec.suny.edu > GPG KEY: 7145F633 > =========================== > > > _______________________________________________ > Ocfs2-devel mailing list > Ocfs2-devel at oss.oracle.com > http://oss.oracle.com/mailman/listinfo/ocfs2-devel > From Joel.Becker at oracle.com Fri Nov 13 14:07:15 2009 From: Joel.Becker at oracle.com (Joel Becker) Date: Fri, 13 Nov 2009 14:07:15 -0800 Subject: [Ocfs2-devel] disable reboots when fencing In-Reply-To: References: Message-ID: <20091113220714.GA9739@mail.oracle.com> On Fri, Nov 13, 2009 at 11:27:08AM -0500, Hoot, Joseph wrote: > What is the OCFS2 v1.4 equivalent to the OCFS2 v1.2 command to disable reboots upon fencing? > > echo 1 > /proc/fs/ocfs2_nodemanager/fence_method The big question is why you want this. You are opening your systems up to data corruption, which is a very bad thing. Joel -- "In the beginning, the universe was created. This has made a lot of people very angry, and is generally considered to have been a bad move." - Douglas Adams Joel Becker Principal Software Developer Oracle E-mail: joel.becker at oracle.com Phone: (650) 506-8127 From Joel.Becker at oracle.com Fri Nov 13 15:54:29 2009 From: Joel.Becker at oracle.com (Joel Becker) Date: Fri, 13 Nov 2009 15:54:29 -0800 Subject: [Ocfs2-devel] [PATCH 1/1] ocfs2: Trivial cleanup of jbd compatibility layer removal In-Reply-To: <1257547822-4246-1-git-send-email-sunil.mushran@oracle.com> References: <1257547822-4246-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <20091113235429.GD9739@mail.oracle.com> On Fri, Nov 06, 2009 at 02:50:22PM -0800, Sunil Mushran wrote: > Mainline commit 53ef99cad9878f02f27bb30bc304fc42af8bdd6e removed the > JBD compatibility layer from OCFS2. This patch removes the last remaining > remnants of that. > > Signed-off-by: Sunil Mushran This patch is now in the "fixes" branch of ocfs2.git. Joel -- "I don't know anything about music. In my line you don't have to." - Elvis Presley Joel Becker Principal Software Developer Oracle E-mail: joel.becker at oracle.com Phone: (650) 506-8127 From Joel.Becker at oracle.com Fri Nov 13 15:54:07 2009 From: Joel.Becker at oracle.com (Joel Becker) Date: Fri, 13 Nov 2009 15:54:07 -0800 Subject: [Ocfs2-devel] [PATCH 1/1] ocfs2: Refresh documentation In-Reply-To: <1257197890-16493-1-git-send-email-sunil.mushran@oracle.com> References: <1257197890-16493-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <20091113235407.GC9739@mail.oracle.com> On Mon, Nov 02, 2009 at 01:38:10PM -0800, Sunil Mushran wrote: > Signed-off-by: Sunil Mushran In the "fixes" branch of ocfs2.git. Joel -- Joel's First Law: Nature abhors a GUI. Joel Becker Principal Software Developer Oracle E-mail: joel.becker at oracle.com Phone: (650) 506-8127 From sunil.mushran at oracle.com Tue Nov 17 13:07:58 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Tue, 17 Nov 2009 13:07:58 -0800 Subject: [Ocfs2-devel] [PATCH 1/1] ocfs2/cluster: Make fence method configurable Message-ID: <1258492078-32200-1-git-send-email-sunil.mushran@oracle.com> By default, o2cb fences the box by calling emergency_restart(). While this scheme works well in production, it comes in the way during testing as it does not let the tester take stack/core dumps for analysis. This patch allows user to dynamically change the fence method to panic() by: # echo "panic" > /sys/kernel/config/cluster//fence_method Signed-off-by: Sunil Mushran --- fs/ocfs2/cluster/nodemanager.c | 50 ++++++++++++++++++++++++++++++++++++++++ fs/ocfs2/cluster/nodemanager.h | 7 +++++ fs/ocfs2/cluster/quorum.c | 14 +++++++++- 3 files changed, 69 insertions(+), 2 deletions(-) diff --git a/fs/ocfs2/cluster/nodemanager.c b/fs/ocfs2/cluster/nodemanager.c index 7ee6188..77cdc09 100644 --- a/fs/ocfs2/cluster/nodemanager.c +++ b/fs/ocfs2/cluster/nodemanager.c @@ -35,6 +35,11 @@ * cluster references throughout where nodes are looked up */ struct o2nm_cluster *o2nm_single_cluster = NULL; +char *o2nm_fence_method_desc[O2NM_FENCE_METHODS + 1] = { + "reset", /* O2NM_FENCE_RESET */ + "panic", /* O2NM_FENCE_PANIC */ + "unknown", +}; struct o2nm_node *o2nm_get_node_by_num(u8 node_num) { @@ -579,6 +584,41 @@ static ssize_t o2nm_cluster_attr_reconnect_delay_ms_write( return o2nm_cluster_attr_write(page, count, &cluster->cl_reconnect_delay_ms); } + +static ssize_t o2nm_cluster_attr_fence_method_read( + struct o2nm_cluster *cluster, char *page) +{ + unsigned int i = O2NM_FENCE_METHODS; + + if (cluster && cluster->cl_fence_method < O2NM_FENCE_METHODS) + i = cluster->cl_fence_method; + + return sprintf(page, "%s\n", o2nm_fence_method_desc[i]); +} + +static ssize_t o2nm_cluster_attr_fence_method_write( + struct o2nm_cluster *cluster, const char *page, size_t count) +{ + unsigned int i; + + if (page[count - 1] != '\n') + goto bail; + + for (i = 0; i < O2NM_FENCE_METHODS; ++i) { + if (count != strlen(o2nm_fence_method_desc[i]) + 1) + continue; + if (!strncasecmp(page, o2nm_fence_method_desc[i], count - 1)) { + printk(KERN_INFO "ocfs2: Changing fence method to %s\n", + o2nm_fence_method_desc[i]); + cluster->cl_fence_method = i; + return count; + } + } + +bail: + return -EINVAL; +} + static struct o2nm_cluster_attribute o2nm_cluster_attr_idle_timeout_ms = { .attr = { .ca_owner = THIS_MODULE, .ca_name = "idle_timeout_ms", @@ -603,10 +643,19 @@ static struct o2nm_cluster_attribute o2nm_cluster_attr_reconnect_delay_ms = { .store = o2nm_cluster_attr_reconnect_delay_ms_write, }; +static struct o2nm_cluster_attribute o2nm_cluster_attr_fence_method = { + .attr = { .ca_owner = THIS_MODULE, + .ca_name = "fence_method", + .ca_mode = S_IRUGO | S_IWUSR }, + .show = o2nm_cluster_attr_fence_method_read, + .store = o2nm_cluster_attr_fence_method_write, +}; + static struct configfs_attribute *o2nm_cluster_attrs[] = { &o2nm_cluster_attr_idle_timeout_ms.attr, &o2nm_cluster_attr_keepalive_delay_ms.attr, &o2nm_cluster_attr_reconnect_delay_ms.attr, + &o2nm_cluster_attr_fence_method.attr, NULL, }; static ssize_t o2nm_cluster_show(struct config_item *item, @@ -778,6 +827,7 @@ static struct config_group *o2nm_cluster_group_make_group(struct config_group *g cluster->cl_reconnect_delay_ms = O2NET_RECONNECT_DELAY_MS_DEFAULT; cluster->cl_idle_timeout_ms = O2NET_IDLE_TIMEOUT_MS_DEFAULT; cluster->cl_keepalive_delay_ms = O2NET_KEEPALIVE_DELAY_MS_DEFAULT; + cluster->cl_fence_method = O2NM_FENCE_RESET; ret = &cluster->cl_group; o2nm_single_cluster = cluster; diff --git a/fs/ocfs2/cluster/nodemanager.h b/fs/ocfs2/cluster/nodemanager.h index c992ea0..09ea2d3 100644 --- a/fs/ocfs2/cluster/nodemanager.h +++ b/fs/ocfs2/cluster/nodemanager.h @@ -33,6 +33,12 @@ #include #include +enum o2nm_fence_method { + O2NM_FENCE_RESET = 0, + O2NM_FENCE_PANIC, + O2NM_FENCE_METHODS, /* Number of fence methods */ +}; + struct o2nm_node { spinlock_t nd_lock; struct config_item nd_item; @@ -58,6 +64,7 @@ struct o2nm_cluster { unsigned int cl_idle_timeout_ms; unsigned int cl_keepalive_delay_ms; unsigned int cl_reconnect_delay_ms; + enum o2nm_fence_method cl_fence_method; /* this bitmap is part of a hack for disk bitmap.. will go eventually. - zab */ unsigned long cl_nodes_bitmap[BITS_TO_LONGS(O2NM_MAX_NODES)]; diff --git a/fs/ocfs2/cluster/quorum.c b/fs/ocfs2/cluster/quorum.c index bbacf7d..cc6ed4e 100644 --- a/fs/ocfs2/cluster/quorum.c +++ b/fs/ocfs2/cluster/quorum.c @@ -74,8 +74,18 @@ static void o2quo_fence_self(void) * threads can still schedule, etc, etc */ o2hb_stop_all_regions(); - printk("ocfs2 is very sorry to be fencing this system by restarting\n"); - emergency_restart(); + switch (o2nm_single_cluster->cl_fence_method) { + case O2NM_FENCE_PANIC: + panic("*** ocfs2 is very sorry to be fencing this system by " + "panicing ***\n"); + break; + case O2NM_FENCE_RESET: + default: + printk("*** ocfs2 is very sorry to be fencing this system by " + "restarting ***\n"); + emergency_restart(); + break; + }; } /* Indicate that a timeout occured on a hearbeat region write. The -- 1.5.6.5 From Joel.Becker at oracle.com Tue Nov 17 13:43:28 2009 From: Joel.Becker at oracle.com (Joel Becker) Date: Tue, 17 Nov 2009 13:43:28 -0800 Subject: [Ocfs2-devel] [PATCH 1/1] ocfs2/cluster: Make fence method configurable In-Reply-To: <1258492078-32200-1-git-send-email-sunil.mushran@oracle.com> References: <1258492078-32200-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <20091117214328.GC18683@mail.oracle.com> On Tue, Nov 17, 2009 at 01:07:58PM -0800, Sunil Mushran wrote: > By default, o2cb fences the box by calling emergency_restart(). While this > scheme works well in production, it comes in the way during testing as it > does not let the tester take stack/core dumps for analysis. > > This patch allows user to dynamically change the fence method to panic() by: > # echo "panic" > /sys/kernel/config/cluster//fence_method > > Signed-off-by: Sunil Mushran > --- > fs/ocfs2/cluster/nodemanager.c | 50 ++++++++++++++++++++++++++++++++++++++++ > fs/ocfs2/cluster/nodemanager.h | 7 +++++ > fs/ocfs2/cluster/quorum.c | 14 +++++++++- > 3 files changed, 69 insertions(+), 2 deletions(-) > > diff --git a/fs/ocfs2/cluster/nodemanager.c b/fs/ocfs2/cluster/nodemanager.c > index 7ee6188..77cdc09 100644 > --- a/fs/ocfs2/cluster/nodemanager.c > +++ b/fs/ocfs2/cluster/nodemanager.c > @@ -35,6 +35,11 @@ > * cluster references throughout where nodes are looked up */ > struct o2nm_cluster *o2nm_single_cluster = NULL; > > +char *o2nm_fence_method_desc[O2NM_FENCE_METHODS + 1] = { > + "reset", /* O2NM_FENCE_RESET */ > + "panic", /* O2NM_FENCE_PANIC */ > + "unknown", > +}; Why do you have "unknown"? There's no point to it; we default to "reset" and you never allow anything about O2NM_FENCE_METHODS to be set. > +static ssize_t o2nm_cluster_attr_fence_method_read( > + struct o2nm_cluster *cluster, char *page) > +{ > + unsigned int i = O2NM_FENCE_METHODS; > + > + if (cluster && cluster->cl_fence_method < O2NM_FENCE_METHODS) > + i = cluster->cl_fence_method; cl_fence_method should always be below O2NM_FENCE_METHODS. You only need to check if(cluster). If cl_fence_method is off, we'll crash, which is fine. > + switch (o2nm_single_cluster->cl_fence_method) { > + case O2NM_FENCE_PANIC: > + panic("*** ocfs2 is very sorry to be fencing this system by " > + "panicing ***\n"); > + break; > + case O2NM_FENCE_RESET: > + default: Why not: + default: + WARN_ON(o2nm_single_cluster->cl_fence_method >= + O2NM_FENCE_METHODS); + case O2NM_FENCE_RESET: so that netconsole will catch a wacky cl_fence_method. > + printk("*** ocfs2 is very sorry to be fencing this system by " > + "restarting ***\n"); And here, print KERN_ERR so noone filters it out with low klogd levels. Joel -- "For every complex problem there exists a solution that is brief, concise, and totally wrong." -Unknown Joel Becker Principal Software Developer Oracle E-mail: joel.becker at oracle.com Phone: (650) 506-8127 From sunil.mushran at oracle.com Tue Nov 17 16:29:19 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Tue, 17 Nov 2009 16:29:19 -0800 Subject: [Ocfs2-devel] [PATCH] ocfs2/cluster: Make fence method configurable - v2 Message-ID: <1258504159-19981-1-git-send-email-sunil.mushran@oracle.com> By default, o2cb fences the box by calling emergency_restart(). While this scheme works well in production, it comes in the way during testing as it does not let the tester take stack/core dumps for analysis. This patch allows user to dynamically change the fence method to panic() by: # echo "panic" > /sys/kernel/config/cluster//fence_method Signed-off-by: Sunil Mushran --- fs/ocfs2/cluster/nodemanager.c | 51 ++++++++++++++++++++++++++++++++++++++++ fs/ocfs2/cluster/nodemanager.h | 7 +++++ fs/ocfs2/cluster/quorum.c | 16 +++++++++++- 3 files changed, 72 insertions(+), 2 deletions(-) diff --git a/fs/ocfs2/cluster/nodemanager.c b/fs/ocfs2/cluster/nodemanager.c index 7ee6188..c81142e 100644 --- a/fs/ocfs2/cluster/nodemanager.c +++ b/fs/ocfs2/cluster/nodemanager.c @@ -35,6 +35,10 @@ * cluster references throughout where nodes are looked up */ struct o2nm_cluster *o2nm_single_cluster = NULL; +char *o2nm_fence_method_desc[O2NM_FENCE_METHODS] = { + "reset", /* O2NM_FENCE_RESET */ + "panic", /* O2NM_FENCE_PANIC */ +}; struct o2nm_node *o2nm_get_node_by_num(u8 node_num) { @@ -579,6 +583,43 @@ static ssize_t o2nm_cluster_attr_reconnect_delay_ms_write( return o2nm_cluster_attr_write(page, count, &cluster->cl_reconnect_delay_ms); } + +static ssize_t o2nm_cluster_attr_fence_method_read( + struct o2nm_cluster *cluster, char *page) +{ + ssize_t ret = 0; + + if (cluster) + ret = sprintf(page, "%s\n", + o2nm_fence_method_desc[cluster->cl_fence_method]); + return ret; +} + +static ssize_t o2nm_cluster_attr_fence_method_write( + struct o2nm_cluster *cluster, const char *page, size_t count) +{ + unsigned int i; + + if (page[count - 1] != '\n') + goto bail; + + for (i = 0; i < O2NM_FENCE_METHODS; ++i) { + if (count != strlen(o2nm_fence_method_desc[i]) + 1) + continue; + if (strncasecmp(page, o2nm_fence_method_desc[i], count - 1)) + continue; + if (cluster->cl_fence_method != i) { + printk(KERN_INFO "ocfs2: Changing fence method to %s\n", + o2nm_fence_method_desc[i]); + cluster->cl_fence_method = i; + } + return count; + } + +bail: + return -EINVAL; +} + static struct o2nm_cluster_attribute o2nm_cluster_attr_idle_timeout_ms = { .attr = { .ca_owner = THIS_MODULE, .ca_name = "idle_timeout_ms", @@ -603,10 +644,19 @@ static struct o2nm_cluster_attribute o2nm_cluster_attr_reconnect_delay_ms = { .store = o2nm_cluster_attr_reconnect_delay_ms_write, }; +static struct o2nm_cluster_attribute o2nm_cluster_attr_fence_method = { + .attr = { .ca_owner = THIS_MODULE, + .ca_name = "fence_method", + .ca_mode = S_IRUGO | S_IWUSR }, + .show = o2nm_cluster_attr_fence_method_read, + .store = o2nm_cluster_attr_fence_method_write, +}; + static struct configfs_attribute *o2nm_cluster_attrs[] = { &o2nm_cluster_attr_idle_timeout_ms.attr, &o2nm_cluster_attr_keepalive_delay_ms.attr, &o2nm_cluster_attr_reconnect_delay_ms.attr, + &o2nm_cluster_attr_fence_method.attr, NULL, }; static ssize_t o2nm_cluster_show(struct config_item *item, @@ -778,6 +828,7 @@ static struct config_group *o2nm_cluster_group_make_group(struct config_group *g cluster->cl_reconnect_delay_ms = O2NET_RECONNECT_DELAY_MS_DEFAULT; cluster->cl_idle_timeout_ms = O2NET_IDLE_TIMEOUT_MS_DEFAULT; cluster->cl_keepalive_delay_ms = O2NET_KEEPALIVE_DELAY_MS_DEFAULT; + cluster->cl_fence_method = O2NM_FENCE_RESET; ret = &cluster->cl_group; o2nm_single_cluster = cluster; diff --git a/fs/ocfs2/cluster/nodemanager.h b/fs/ocfs2/cluster/nodemanager.h index c992ea0..09ea2d3 100644 --- a/fs/ocfs2/cluster/nodemanager.h +++ b/fs/ocfs2/cluster/nodemanager.h @@ -33,6 +33,12 @@ #include #include +enum o2nm_fence_method { + O2NM_FENCE_RESET = 0, + O2NM_FENCE_PANIC, + O2NM_FENCE_METHODS, /* Number of fence methods */ +}; + struct o2nm_node { spinlock_t nd_lock; struct config_item nd_item; @@ -58,6 +64,7 @@ struct o2nm_cluster { unsigned int cl_idle_timeout_ms; unsigned int cl_keepalive_delay_ms; unsigned int cl_reconnect_delay_ms; + enum o2nm_fence_method cl_fence_method; /* this bitmap is part of a hack for disk bitmap.. will go eventually. - zab */ unsigned long cl_nodes_bitmap[BITS_TO_LONGS(O2NM_MAX_NODES)]; diff --git a/fs/ocfs2/cluster/quorum.c b/fs/ocfs2/cluster/quorum.c index bbacf7d..6390240 100644 --- a/fs/ocfs2/cluster/quorum.c +++ b/fs/ocfs2/cluster/quorum.c @@ -74,8 +74,20 @@ static void o2quo_fence_self(void) * threads can still schedule, etc, etc */ o2hb_stop_all_regions(); - printk("ocfs2 is very sorry to be fencing this system by restarting\n"); - emergency_restart(); + switch (o2nm_single_cluster->cl_fence_method) { + case O2NM_FENCE_PANIC: + panic("*** ocfs2 is very sorry to be fencing this system by " + "panicing ***\n"); + break; + default: + WARN_ON(o2nm_single_cluster->cl_fence_method >= + O2NM_FENCE_METHODS); + case O2NM_FENCE_RESET: + printk(KERN_ERR "*** ocfs2 is very sorry to be fencing this " + "system by restarting ***\n"); + emergency_restart(); + break; + }; } /* Indicate that a timeout occured on a hearbeat region write. The -- 1.5.6.5 From tiger.yang at oracle.com Wed Nov 18 02:35:28 2009 From: tiger.yang at oracle.com (Tiger Yang) Date: Wed, 18 Nov 2009 18:35:28 +0800 Subject: [Ocfs2-devel] [PATCH 1/1] ocfs2: return -EAGAIN instead of EAGAIN in dlm Message-ID: <1258540528-3377-1-git-send-email-tiger.yang@oracle.com> We used to return positive EAGAIN to indicate a retry action is needed in dlm_begin_reco_handler(). Now we use negative -EAGAIN to erase the confusion caused by this error code. Signed-off-by: Tiger Yang --- fs/ocfs2/dlm/dlmrecovery.c | 19 ++++++++++--------- 1 files changed, 10 insertions(+), 9 deletions(-) diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c index d9fa3d2..8818c8c 100644 --- a/fs/ocfs2/dlm/dlmrecovery.c +++ b/fs/ocfs2/dlm/dlmrecovery.c @@ -2589,6 +2589,15 @@ retry: "begin reco msg (%d)\n", dlm->name, nodenum, ret); ret = 0; } + if (ret == -EAGAIN) { + mlog(0, "%s: trying to start recovery of node " + "%u, but node %u is waiting for last recovery " + "to complete, backoff for a bit\n", dlm->name, + dead_node, nodenum); + /*TODO Look into replacing msleep with cond_resched()*/ + msleep(100); + goto retry; + } if (ret < 0) { struct dlm_lock_resource *res; /* this is now a serious problem, possibly ENOMEM @@ -2608,14 +2617,6 @@ retry: * another ENOMEM */ msleep(100); goto retry; - } else if (ret == EAGAIN) { - mlog(0, "%s: trying to start recovery of node " - "%u, but node %u is waiting for last recovery " - "to complete, backoff for a bit\n", dlm->name, - dead_node, nodenum); - /* TODO Look into replacing msleep with cond_resched() */ - msleep(100); - goto retry; } } @@ -2639,7 +2640,7 @@ int dlm_begin_reco_handler(struct o2net_msg *msg, u32 len, void *data, dlm->name, br->node_idx, br->dead_node, dlm->reco.dead_node, dlm->reco.new_master); spin_unlock(&dlm->spinlock); - return EAGAIN; + return -EAGAIN; } spin_unlock(&dlm->spinlock); -- 1.6.2.5 From sunil.mushran at oracle.com Wed Nov 18 14:26:47 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Wed, 18 Nov 2009 14:26:47 -0800 Subject: [Ocfs2-devel] [PATCH 1/1] ocfs2: return -EAGAIN instead of EAGAIN in dlm In-Reply-To: <1258540528-3377-1-git-send-email-tiger.yang@oracle.com> References: <1258540528-3377-1-git-send-email-tiger.yang@oracle.com> Message-ID: <4B0474A7.9020506@oracle.com> Signed-off-by: Sunil Mushran comments inlined Tiger Yang wrote: > We used to return positive EAGAIN to indicate a retry action > is needed in dlm_begin_reco_handler(). Now we use negative -EAGAIN > to erase the confusion caused by this error code. > > Signed-off-by: Tiger Yang > --- > fs/ocfs2/dlm/dlmrecovery.c | 19 ++++++++++--------- > 1 files changed, 10 insertions(+), 9 deletions(-) > > diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c > index d9fa3d2..8818c8c 100644 > --- a/fs/ocfs2/dlm/dlmrecovery.c > +++ b/fs/ocfs2/dlm/dlmrecovery.c > @@ -2589,6 +2589,15 @@ retry: > "begin reco msg (%d)\n", dlm->name, nodenum, ret); > ret = 0; > } > + if (ret == -EAGAIN) { > + mlog(0, "%s: trying to start recovery of node " > + "%u, but node %u is waiting for last recovery " > + "to complete, backoff for a bit\n", dlm->name, > + dead_node, nodenum); > + /*TODO Look into replacing msleep with cond_resched()*/ This comment can be removed. We cannot replace the msleep with cond_resched(). If anything we may want to increase the msleep to 1 sec. But leave that as is for now. > + msleep(100); > + goto retry; > + } > if (ret < 0) { > struct dlm_lock_resource *res; > /* this is now a serious problem, possibly ENOMEM > @@ -2608,14 +2617,6 @@ retry: > * another ENOMEM */ > msleep(100); > goto retry; > - } else if (ret == EAGAIN) { > - mlog(0, "%s: trying to start recovery of node " > - "%u, but node %u is waiting for last recovery " > - "to complete, backoff for a bit\n", dlm->name, > - dead_node, nodenum); > - /* TODO Look into replacing msleep with cond_resched() */ > - msleep(100); > - goto retry; > } > } > > @@ -2639,7 +2640,7 @@ int dlm_begin_reco_handler(struct o2net_msg *msg, u32 len, void *data, > dlm->name, br->node_idx, br->dead_node, > dlm->reco.dead_node, dlm->reco.new_master); > spin_unlock(&dlm->spinlock); > - return EAGAIN; > + return -EAGAIN; > } > spin_unlock(&dlm->spinlock); > This looks sane. Though I would like someone else to review it too as we have no real way of testing this. From tiger.yang at oracle.com Wed Nov 18 18:17:46 2009 From: tiger.yang at oracle.com (Tiger Yang) Date: Thu, 19 Nov 2009 10:17:46 +0800 Subject: [Ocfs2-devel] [PATCH 1/1] ocfs2: return -EAGAIN instead of EAGAIN in dlm In-Reply-To: <4B0474A7.9020506@oracle.com> References: <4B0474A7.9020506@oracle.com> Message-ID: <1258597066-9227-1-git-send-email-tiger.yang@oracle.com> We used to return positive EAGAIN to indicate a retry action is needed in dlm_begin_reco_handler(). Now we return negative -EAGAIN to erase the confusion caused by this error code. Signed-off-by: Tiger Yang --- fs/ocfs2/dlm/dlmrecovery.c | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-) diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c index d9fa3d2..2f9e4e1 100644 --- a/fs/ocfs2/dlm/dlmrecovery.c +++ b/fs/ocfs2/dlm/dlmrecovery.c @@ -2589,6 +2589,14 @@ retry: "begin reco msg (%d)\n", dlm->name, nodenum, ret); ret = 0; } + if (ret == -EAGAIN) { + mlog(0, "%s: trying to start recovery of node " + "%u, but node %u is waiting for last recovery " + "to complete, backoff for a bit\n", dlm->name, + dead_node, nodenum); + msleep(100); + goto retry; + } if (ret < 0) { struct dlm_lock_resource *res; /* this is now a serious problem, possibly ENOMEM @@ -2608,14 +2616,6 @@ retry: * another ENOMEM */ msleep(100); goto retry; - } else if (ret == EAGAIN) { - mlog(0, "%s: trying to start recovery of node " - "%u, but node %u is waiting for last recovery " - "to complete, backoff for a bit\n", dlm->name, - dead_node, nodenum); - /* TODO Look into replacing msleep with cond_resched() */ - msleep(100); - goto retry; } } @@ -2639,7 +2639,7 @@ int dlm_begin_reco_handler(struct o2net_msg *msg, u32 len, void *data, dlm->name, br->node_idx, br->dead_node, dlm->reco.dead_node, dlm->reco.new_master); spin_unlock(&dlm->spinlock); - return EAGAIN; + return -EAGAIN; } spin_unlock(&dlm->spinlock); -- 1.6.2.5 From Joel.Becker at oracle.com Thu Nov 19 18:47:02 2009 From: Joel.Becker at oracle.com (Joel Becker) Date: Thu, 19 Nov 2009 18:47:02 -0800 Subject: [Ocfs2-devel] [GIT PULL] ocfs2 updates for 2.6.32-rc8 Message-ID: <20091120024701.GA12968@mail.oracle.com> Linus et al, Here are a few small fixes for ocfs2. The most important one fixes a crash when duplicating inline data properly. Please pull. Joel The following changes since commit 964fe080d94db82a3268443e9b9ece4c60246414: Linus Torvalds (1): Merge git://git.kernel.org/.../rusty/linux-2.6-for-linus are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/jlbec/ocfs2.git upstream-linus Coly Li (1): ocfs2: return f_fsid info in ocfs2_statfs() Joel Becker (1): ocfs2: Return -EINVAL when a device is not ocfs2. Sunil Mushran (2): ocfs2: Refresh documentation ocfs2: Trivial cleanup of jbd compatibility layer removal Tao Ma (2): ocfs2: Move ocfs2_complete_reflink to the right place. ocfs2: duplicate inline data properly during reflink. Documentation/filesystems/ocfs2.txt | 6 ++-- fs/ocfs2/file.c | 3 +- fs/ocfs2/ocfs2.h | 7 +--- fs/ocfs2/refcounttree.c | 69 ++++++++++++++++++++++++++++++++--- fs/ocfs2/super.c | 20 +++++++---- fs/ocfs2/uptodate.c | 5 --- 6 files changed, 83 insertions(+), 27 deletions(-) -- Life's Little Instruction Book #232 "Keep your promises." Joel Becker Principal Software Developer Oracle E-mail: joel.becker at oracle.com Phone: (650) 506-8127 From srinivas.eeda at oracle.com Thu Nov 19 23:57:25 2009 From: srinivas.eeda at oracle.com (Srinivas Eeda) Date: Thu, 19 Nov 2009 23:57:25 -0800 Subject: [Ocfs2-devel] o2net patch that avoids socket disconnect/reconnect Message-ID: <1258703846-23212-1-git-send-email-srinivas.eeda@oracle.com> This fix modifies o2net layer behavior which seems to trigger some DLM race issues during umount/evictions that needs to be fixed as well. I am working on the dlm issues but meanwhile please review this patch. Thanks, --Srini From srinivas.eeda at oracle.com Thu Nov 19 23:57:26 2009 From: srinivas.eeda at oracle.com (Srinivas Eeda) Date: Thu, 19 Nov 2009 23:57:26 -0800 Subject: [Ocfs2-devel] [PATCH] o2net: delay ENOTCONN for sends receives till quorum decision In-Reply-To: <1258703846-23212-1-git-send-email-srinivas.eeda@oracle.com> References: <1258703846-23212-1-git-send-email-srinivas.eeda@oracle.com> Message-ID: <1258703846-23212-2-git-send-email-srinivas.eeda@oracle.com> When a ocfs2 network heartbeat times out between two nodes, o2net layer breaks the socket connection, and returns -ENOTCONN to processes that are trying send/receive messages to/from other node. It also queues a quorum decision to be made after the disk timeout to resolve split brain. If a connection can be re-established then a new socket is created and quorum decision is canceled. Since sockets are recycled when a reconnect happens, messages could get lost causing file system hangs. The fix queues the quorum decision after network heartbeat timeout but avoids socket disconnects. The fix delays socket disconnects till O2HB_NODE_DOWN_CB event which is triggered on the surviving node after the node evictions happen. Surviving node signals -ENOTCONN to processes waiting to send/receives messages to/from evicted node. If network connection comes back before the eviction, quorum decision is cancelled and messaging resumes. Signed-off-by: Srinivas Eeda --- fs/ocfs2/cluster/tcp.c | 94 +++++++++++++++++++++++---------------- fs/ocfs2/cluster/tcp_internal.h | 9 ++-- 2 files changed, 60 insertions(+), 43 deletions(-) diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c index 334f231..a0b4e58 100644 --- a/fs/ocfs2/cluster/tcp.c +++ b/fs/ocfs2/cluster/tcp.c @@ -141,6 +141,7 @@ static void o2net_sc_send_keep_req(struct work_struct *work); static void o2net_idle_timer(unsigned long data); static void o2net_sc_postpone_idle(struct o2net_sock_container *sc); static void o2net_sc_reset_idle_timer(struct o2net_sock_container *sc); +static void o2net_queue_quorum(struct o2net_node *nn); #ifdef CONFIG_DEBUG_FS static void o2net_init_nst(struct o2net_send_tracking *nst, u32 msgtype, @@ -447,7 +448,6 @@ static void o2net_set_nn_state(struct o2net_node *nn, unsigned valid, int err) { int was_valid = nn->nn_sc_valid; - int was_err = nn->nn_persistent_error; struct o2net_sock_container *old_sc = nn->nn_sc; assert_spin_locked(&nn->nn_lock); @@ -478,12 +478,6 @@ static void o2net_set_nn_state(struct o2net_node *nn, if (nn->nn_persistent_error || nn->nn_sc_valid) wake_up(&nn->nn_sc_wq); - if (!was_err && nn->nn_persistent_error) { - o2quo_conn_err(o2net_num_from_nn(nn)); - queue_delayed_work(o2net_wq, &nn->nn_still_up, - msecs_to_jiffies(O2NET_QUORUM_DELAY_MS)); - } - if (was_valid && !valid) { printk(KERN_INFO "o2net: no longer connected to " SC_NODEF_FMT "\n", SC_NODEF_ARGS(old_sc)); @@ -491,7 +485,6 @@ static void o2net_set_nn_state(struct o2net_node *nn, } if (!was_valid && valid) { - o2quo_conn_up(o2net_num_from_nn(nn)); cancel_delayed_work(&nn->nn_connect_expired); printk(KERN_INFO "o2net: %s " SC_NODEF_FMT "\n", o2nm_this_node() > sc->sc_node->nd_num ? @@ -562,6 +555,7 @@ static void o2net_state_change(struct sock *sk) { void (*state_change)(struct sock *sk); struct o2net_sock_container *sc; + struct o2net_node *nn; read_lock(&sk->sk_callback_lock); sc = sk->sk_user_data; @@ -583,7 +577,11 @@ static void o2net_state_change(struct sock *sk) o2net_sc_queue_work(sc, &sc->sc_connect_work); break; default: - o2net_sc_queue_work(sc, &sc->sc_shutdown_work); + if (sc->sc_handshake_ok) { + nn = o2net_nn_from_num(sc->sc_node->nd_num); + queue_work(o2net_wq, &nn->nn_connection_err); + } else + o2net_sc_queue_work(sc, &sc->sc_shutdown_work); break; } out: @@ -687,6 +685,26 @@ static void o2net_shutdown_sc(struct work_struct *work) sc_put(sc); } +static void o2net_queue_quorum(struct o2net_node *nn) +{ + if (!atomic_read(&nn->nn_quorum_queued)) { + o2quo_conn_err(o2net_num_from_nn(nn)); + queue_delayed_work(o2net_wq, &nn->nn_still_up, + msecs_to_jiffies(O2NET_QUORUM_DELAY_MS)); + atomic_set(&nn->nn_quorum_queued, 1); + } +} + +static void o2net_connection_err(struct work_struct *work) +{ + struct o2net_node *nn = + container_of(work, struct o2net_node, nn_connection_err); + + spin_lock(&nn->nn_lock); + o2net_queue_quorum(nn); + spin_unlock(&nn->nn_lock); +} + /* ------------------------------------------------------------ */ static int o2net_handler_cmp(struct o2net_msg_handler *nmh, u32 msg_type, @@ -1273,7 +1291,6 @@ static int o2net_check_handshake(struct o2net_sock_container *sc) * shut down already */ if (nn->nn_sc == sc) { o2net_sc_reset_idle_timer(sc); - atomic_set(&nn->nn_timeout, 0); o2net_set_nn_state(nn, sc, 1, 0); } spin_unlock(&nn->nn_lock); @@ -1431,8 +1448,6 @@ static void o2net_initialize_handshake(void) o2net_hand->o2net_idle_timeout_ms = cpu_to_be32(o2net_idle_timeout()); o2net_hand->o2net_keepalive_delay_ms = cpu_to_be32( o2net_keepalive_delay()); - o2net_hand->o2net_reconnect_delay_ms = cpu_to_be32( - o2net_reconnect_delay()); } /* ------------------------------------------------------------ */ @@ -1494,13 +1509,7 @@ static void o2net_idle_timer(unsigned long data) sc->sc_tv_func_start.tv_sec, (long) sc->sc_tv_func_start.tv_usec, sc->sc_tv_func_stop.tv_sec, (long) sc->sc_tv_func_stop.tv_usec); - /* - * Initialize the nn_timeout so that the next connection attempt - * will continue in o2net_start_connect. - */ - atomic_set(&nn->nn_timeout, 1); - - o2net_sc_queue_work(sc, &sc->sc_shutdown_work); + queue_work(o2net_wq, &nn->nn_connection_err); } static void o2net_sc_reset_idle_timer(struct o2net_sock_container *sc) @@ -1515,9 +1524,22 @@ static void o2net_sc_reset_idle_timer(struct o2net_sock_container *sc) static void o2net_sc_postpone_idle(struct o2net_sock_container *sc) { - /* Only push out an existing timer */ - if (timer_pending(&sc->sc_idle_timeout)) - o2net_sc_reset_idle_timer(sc); + struct o2net_node *nn = o2net_nn_from_num(sc->sc_node->nd_num); + + /* avoid spin_lock if not needed */ + if (atomic_read(&nn->nn_quorum_queued)) { + spin_lock(&nn->nn_lock); + if (atomic_read(&nn->nn_quorum_queued)) { + o2quo_conn_up(sc->sc_node->nd_num); + cancel_delayed_work(&nn->nn_still_up); + atomic_set(&nn->nn_quorum_queued, 0); + printk(KERN_INFO "o2net: reconnected to " + SC_NODEF_FMT "\n", SC_NODEF_ARGS(sc)); + } + spin_unlock(&nn->nn_lock); + } + + o2net_sc_reset_idle_timer(sc); } /* this work func is kicked whenever a path sets the nn state which doesn't @@ -1534,8 +1556,6 @@ static void o2net_start_connect(struct work_struct *work) struct socket *sock = NULL; struct sockaddr_in myaddr = {0, }, remoteaddr = {0, }; int ret = 0, stop; - unsigned int timeout; - /* if we're greater we initiate tx, otherwise we accept */ if (o2nm_this_node() <= o2net_num_from_nn(nn)) goto out; @@ -1554,17 +1574,9 @@ static void o2net_start_connect(struct work_struct *work) } spin_lock(&nn->nn_lock); - /* - * see if we already have one pending or have given up. - * For nn_timeout, it is set when we close the connection - * because of the idle time out. So it means that we have - * at least connected to that node successfully once, - * now try to connect to it again. - */ - timeout = atomic_read(&nn->nn_timeout); - stop = (nn->nn_sc || - (nn->nn_persistent_error && - (nn->nn_persistent_error != -ENOTCONN || timeout == 0))); + + /* don't queue on broken or pending connection. */ + stop = (nn->nn_sc || nn->nn_persistent_error); spin_unlock(&nn->nn_lock); if (stop) goto out; @@ -1676,7 +1688,10 @@ void o2net_disconnect_node(struct o2nm_node *node) /* don't reconnect until it's heartbeating again */ spin_lock(&nn->nn_lock); - atomic_set(&nn->nn_timeout, 0); + + if (nn->nn_sc) + o2net_sc_queue_work(nn->nn_sc, &nn->nn_sc->sc_shutdown_work); + o2net_set_nn_state(nn, NULL, 0, -ENOTCONN); spin_unlock(&nn->nn_lock); @@ -1685,7 +1700,9 @@ void o2net_disconnect_node(struct o2nm_node *node) cancel_delayed_work(&nn->nn_connect_work); cancel_delayed_work(&nn->nn_still_up); flush_workqueue(o2net_wq); + atomic_set(&nn->nn_quorum_queued, 0); } + o2quo_conn_err(o2net_num_from_nn(nn)); } static void o2net_hb_node_down_cb(struct o2nm_node *node, int node_num, @@ -1716,7 +1733,6 @@ static void o2net_hb_node_up_cb(struct o2nm_node *node, int node_num, * only use set_nn_state to clear the persistent error * if that hasn't already happened */ spin_lock(&nn->nn_lock); - atomic_set(&nn->nn_timeout, 0); if (nn->nn_persistent_error) o2net_set_nn_state(nn, NULL, 0, 0); spin_unlock(&nn->nn_lock); @@ -1839,7 +1855,6 @@ static int o2net_accept_one(struct socket *sock) new_sock = NULL; spin_lock(&nn->nn_lock); - atomic_set(&nn->nn_timeout, 0); o2net_set_nn_state(nn, sc, 0, 0); spin_unlock(&nn->nn_lock); @@ -2037,14 +2052,15 @@ int o2net_init(void) for (i = 0; i < ARRAY_SIZE(o2net_nodes); i++) { struct o2net_node *nn = o2net_nn_from_num(i); - atomic_set(&nn->nn_timeout, 0); spin_lock_init(&nn->nn_lock); INIT_DELAYED_WORK(&nn->nn_connect_work, o2net_start_connect); INIT_DELAYED_WORK(&nn->nn_connect_expired, o2net_connect_expired); INIT_DELAYED_WORK(&nn->nn_still_up, o2net_still_up); + INIT_WORK(&nn->nn_connection_err, o2net_connection_err); /* until we see hb from a node we'll return einval */ nn->nn_persistent_error = -ENOTCONN; + atomic_set(&nn->nn_quorum_queued, 0); init_waitqueue_head(&nn->nn_sc_wq); idr_init(&nn->nn_status_idr); INIT_LIST_HEAD(&nn->nn_status_list); diff --git a/fs/ocfs2/cluster/tcp_internal.h b/fs/ocfs2/cluster/tcp_internal.h index 8d58cfe..7fa1cb0 100644 --- a/fs/ocfs2/cluster/tcp_internal.h +++ b/fs/ocfs2/cluster/tcp_internal.h @@ -75,14 +75,13 @@ * - full 64 bit i_size in the metadata lock lvbs * - introduction of "rw" lock and pushing meta/data locking down */ -#define O2NET_PROTOCOL_VERSION 11ULL +#define O2NET_PROTOCOL_VERSION 12ULL struct o2net_handshake { __be64 protocol_version; __be64 connector_id; __be32 o2hb_heartbeat_timeout_ms; __be32 o2net_idle_timeout_ms; __be32 o2net_keepalive_delay_ms; - __be32 o2net_reconnect_delay_ms; }; struct o2net_node { @@ -95,8 +94,9 @@ struct o2net_node { unsigned nn_sc_valid:1; /* if this is set tx just returns it */ int nn_persistent_error; - /* It is only set to 1 after the idle time out. */ - atomic_t nn_timeout; + + /* It is toggled between quorum fired and cancelled */ + atomic_t nn_quorum_queued; /* threads waiting for an sc to arrive wait on the wq for generation * to increase. it is increased when a connecting socket succeeds @@ -125,6 +125,7 @@ struct o2net_node { * that it is still heartbeating and that we should do some * quorum work */ struct delayed_work nn_still_up; + struct work_struct nn_connection_err; }; struct o2net_sock_container { -- 1.5.6.5 From sunil.mushran at oracle.com Fri Nov 20 17:12:49 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Fri, 20 Nov 2009 17:12:49 -0800 Subject: [Ocfs2-devel] [PATCH 02/10] ocfs2: Temporarily disable splice i/o In-Reply-To: <1258765977-4334-1-git-send-email-sunil.mushran@oracle.com> References: <1258765977-4334-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1258765977-4334-3-git-send-email-sunil.mushran@oracle.com> This patch disables splice i/o temporarily. It will be enabled later. TODO: Enable splice. Signed-off-by: Sunil Mushran --- Config.make.in | 1 + configure.in | 5 +++++ fs/ocfs2/Makefile | 4 ++++ fs/ocfs2/file.c | 8 ++++++++ fs/ocfs2/xattr.c | 2 ++ 5 files changed, 20 insertions(+), 0 deletions(-) diff --git a/Config.make.in b/Config.make.in index 02b8c9c..a2365e4 100644 --- a/Config.make.in +++ b/Config.make.in @@ -78,6 +78,7 @@ NO_FAULT_IN_VMOPS = @NO_FAULT_IN_VMOPS@ GET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN = @GET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN@ NO_SHOULD_REMOVE_SUID = @NO_SHOULD_REMOVE_SUID@ HAS_FOPS_SENDFILE = @HAS_FOPS_SENDFILE@ +SKIP_SPLICE = @SKIP_SPLICE@ OCFS_DEBUG = @OCFS_DEBUG@ diff --git a/configure.in b/configure.in index 5bc9d42..f028444 100644 --- a/configure.in +++ b/configure.in @@ -414,6 +414,11 @@ OCFS2_CHECK_KERNEL([ fops->sendfile() in fs.h], fs.h, HAS_FOPS_SENDFILE=yes, , [^.*ssize_t (\*sendfile)]) AC_SUBST(HAS_FOPS_SENDFILE) +SKIP_SPLICE= +OCFS2_CHECK_KERNEL([splice.h], splice.h, + , SKIP_SPLICE=yes, [struct splice_desc {]) +AC_SUBST(SKIP_SPLICE) + # End kapi_compat checks # using -include has two advantages: diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile index 2e85623..ba2a3ea 100644 --- a/fs/ocfs2/Makefile +++ b/fs/ocfs2/Makefile @@ -114,6 +114,10 @@ ifdef HAS_FOPS_SENDFILE EXTRA_CFLAGS += -DHAS_FOPS_SENDFILE endif +ifdef SKIP_SPLICE +EXTRA_CFLAGS += -DSKIP_SPLICE +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes. diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index de75f5a..81bd622 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c @@ -31,7 +31,9 @@ #include #include #include +#ifndef SKIP_SPLICE #include +#endif #include #include #include @@ -2058,6 +2060,7 @@ out_sems: return ret; } +#ifndef SKIP_SPLICE static int ocfs2_splice_to_file(struct pipe_inode_info *pipe, struct file *out, struct splice_desc *sd) @@ -2171,6 +2174,7 @@ bail: mlog_exit(ret); return ret; } +#endif /* SKIP SPLICE */ static ssize_t __ocfs2_file_aio_read(struct kiocb *iocb, const struct iovec *iov, @@ -2334,8 +2338,10 @@ const struct file_operations ocfs2_fops = { #endif .lock = ocfs2_lock, .flock = ocfs2_flock, +#ifndef SKIP_SPLICE .splice_read = ocfs2_file_splice_read, .splice_write = ocfs2_file_splice_write, +#endif #ifdef HAS_FOPS_SENDFILE .sendfile = ocfs2_file_sendfile, #endif @@ -2383,8 +2389,10 @@ const struct file_operations ocfs2_fops_no_plocks = { .compat_ioctl = ocfs2_compat_ioctl, #endif .flock = ocfs2_flock, +#ifndef SKIP_SPLICE .splice_read = ocfs2_file_splice_read, .splice_write = ocfs2_file_splice_write, +#endif #ifdef HAS_FOPS_SENDFILE .sendfile = ocfs2_file_sendfile, #endif diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c index fe34190..9a03d9b 100644 --- a/fs/ocfs2/xattr.c +++ b/fs/ocfs2/xattr.c @@ -27,7 +27,9 @@ #include #include #include +#ifndef SKIP_SPLICE #include +#endif #include #include #include -- 1.5.6.5 From sunil.mushran at oracle.com Fri Nov 20 17:12:54 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Fri, 20 Nov 2009 17:12:54 -0800 Subject: [Ocfs2-devel] [PATCH 07/10] ocfs2: Handle missing kobj_attribute In-Reply-To: <1258765977-4334-1-git-send-email-sunil.mushran@oracle.com> References: <1258765977-4334-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1258765977-4334-8-git-send-email-sunil.mushran@oracle.com> Mainline commit 23b5212cc7422f475b82124334b64277b5b43013 added kobj_attribute. This patch adds compat code to allow the fs to build on older EL5 kernels. Signed-off-by: Sunil Mushran --- Config.make.in | 1 + Makefile | 3 +- configure.in | 6 ++ fs/ocfs2/Makefile | 8 +++- fs/ocfs2/cluster/Makefile | 6 ++- fs/ocfs2/cluster/kapi-default.h | 10 ++++ fs/ocfs2/cluster/sys.c | 16 +++--- fs/ocfs2/compat_kobject.c | 90 ++++++++++++++++++++++++++++++++++ fs/ocfs2/kapi-default.h | 10 ++++ fs/ocfs2/stackglue.c | 10 ++-- kapi-compat/include/compat_kobject.h | 29 +++++++++++ 11 files changed, 173 insertions(+), 16 deletions(-) create mode 100644 fs/ocfs2/compat_kobject.c create mode 100644 kapi-compat/include/compat_kobject.h diff --git a/Config.make.in b/Config.make.in index 0107e2e..dd2e406 100644 --- a/Config.make.in +++ b/Config.make.in @@ -81,6 +81,7 @@ HAS_FOPS_SENDFILE = @HAS_FOPS_SENDFILE@ SKIP_SPLICE = @SKIP_SPLICE@ SKIP_BUFFER_TRIGGERS = @SKIP_BUFFER_TRIGGERS@ NO_NAME_IN_BACKING_DEV_INFO=@NO_NAME_IN_BACKING_DEV_INFO@ +NO_KOBJ_ATTRIBUTE = @NO_KOBJ_ATTRIBUTE@ OCFS_DEBUG = @OCFS_DEBUG@ diff --git a/Makefile b/Makefile index fd34d67..7c48788 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/filemap_fdatawait_range.h \ kapi-compat/include/mnt_want_write.h \ kapi-compat/include/hardsect.h \ - kapi-compat/include/triggers.h + kapi-compat/include/triggers.h \ + kapi-compat/include/compat_kobject.h PATCH_FILES = diff --git a/configure.in b/configure.in index 0a3a356..22245ec 100644 --- a/configure.in +++ b/configure.in @@ -440,6 +440,12 @@ OCFS2_CHECK_KERNEL([name in backing-dev.h], backing-dev.h, , NO_NAME_IN_BACKING_DEV_INFO=yes, [char.*\*name;$]) AC_SUBST(NO_NAME_IN_BACKING_DEV_INFO) +NO_KOBJ_ATTRIBUTE= +OCFS2_CHECK_KERNEL([struct kobj_attribute in kobject.h], kobject.h, + , NO_KOBJ_ATTRIBUTE=compat_kobject.h, [^struct kobj_attribute {]) +AC_SUBST(NO_KOBJ_ATTRIBUTE) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $NO_KOBJ_ATTRIBUTE" + # End kapi_compat checks # using -include has two advantages: diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile index 1e8fed6..c02cbee 100644 --- a/fs/ocfs2/Makefile +++ b/fs/ocfs2/Makefile @@ -122,6 +122,12 @@ ifdef SKIP_BUFFER_TRIGGERS CFLAGS_journal.o += -DSKIP_BUFFER_TRIGGERS endif +COMPAT_SOURCES += compat_kobject.c +ifdef NO_KOBJ_ATTRIBUTE +FS_SOURCES += compat_kobject.c +EXTRA_CFLAGS += -DNO_KOBJ_ATTRIBUTE +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes. @@ -156,7 +162,7 @@ INSTALL_MOD_DIR := fs/ocfs2 obj-m := ocfs2.o ocfs2_stackglue.o ocfs2_stack_o2cb.o ocfs2_stack_user.o ocfs2-objs := $(FS_OBJECTS) -ocfs2_stackglue-objs := stackglue.o +ocfs2_stackglue-objs := stackglue.o compat_kobject.o ocfs2_stack_o2cb-objs := stack_o2cb.o ocfs2_stack_user-objs := stack_user.o diff --git a/fs/ocfs2/cluster/Makefile b/fs/ocfs2/cluster/Makefile index d107cca..7336217 100644 --- a/fs/ocfs2/cluster/Makefile +++ b/fs/ocfs2/cluster/Makefile @@ -30,6 +30,10 @@ ifdef OLD_BIO_END_IO_T EXTRA_CFLAGS += -DOLD_BIO_END_IO_T endif +ifdef NO_KOBJ_ATTRIBUTE +EXTRA_CFLAGS += -DNO_KOBJ_ATTRIBUTE +endif + SOURCES += \ heartbeat.c \ masklog.c \ @@ -52,7 +56,7 @@ HEADERS += \ tcp_internal.h \ ver.h -OBJECTS = $(subst .c,.o,$(SOURCES)) +OBJECTS = $(subst .c,.o,$(SOURCES)) ../compat_kobject.o VERSION_FILES = $(SOURCES) $(HEADERS) $(COMPAT_SOURCES) $(COMPAT_HEADERS) VERSION_SRC = ver.c VERSION_PREFIX = CLUSTER diff --git a/fs/ocfs2/cluster/kapi-default.h b/fs/ocfs2/cluster/kapi-default.h index 81dce2f..36976f1 100644 --- a/fs/ocfs2/cluster/kapi-default.h +++ b/fs/ocfs2/cluster/kapi-default.h @@ -42,4 +42,14 @@ typedef struct work_struct kapi_work_struct_t; # define su_mutex su_mutex #endif +#ifndef kapi_kset +# define kapi_kset kset +# define kapi_kset_create_and_add(a, b, c) kset_create_and_add(a, b, c) +# define kapi_kset_unregister(a) kset_unregister(a) +# define kapi_to_kobj(a) (&((a)->kobj)) +# define kapi_to_kset(a) (a) +# define kapi_sysfs_create_link(a, b, c) sysfs_create_link(a, b, c) +# define kapi_sysfs_remove_link(a, b) sysfs_remove_link(a, b) +#endif + #endif diff --git a/fs/ocfs2/cluster/sys.c b/fs/ocfs2/cluster/sys.c index bc702da..46d32c6 100644 --- a/fs/ocfs2/cluster/sys.c +++ b/fs/ocfs2/cluster/sys.c @@ -52,20 +52,20 @@ static struct attribute_group o2cb_attr_group = { .attrs = o2cb_attrs, }; -static struct kset *o2cb_kset; +static struct kapi_kset *o2cb_kset; void o2cb_sys_shutdown(void) { mlog_sys_shutdown(); - sysfs_remove_link(NULL, "o2cb"); - kset_unregister(o2cb_kset); + kapi_sysfs_remove_link(NULL, "o2cb"); + kapi_kset_unregister(o2cb_kset); } int o2cb_sys_init(void) { int ret; - o2cb_kset = kset_create_and_add("o2cb", NULL, fs_kobj); + o2cb_kset = kapi_kset_create_and_add("o2cb", NULL, fs_kobj); if (!o2cb_kset) return -ENOMEM; @@ -73,19 +73,19 @@ int o2cb_sys_init(void) * Create this symlink for backwards compatibility with old * versions of ocfs2-tools which look for things in /sys/o2cb. */ - ret = sysfs_create_link(NULL, &o2cb_kset->kobj, "o2cb"); + ret = kapi_sysfs_create_link(NULL, &o2cb_kset->kobj, "o2cb"); if (ret) goto error; - ret = sysfs_create_group(&o2cb_kset->kobj, &o2cb_attr_group); + ret = sysfs_create_group(kapi_to_kobj(o2cb_kset), &o2cb_attr_group); if (ret) goto error; - ret = mlog_sys_init(o2cb_kset); + ret = mlog_sys_init(kapi_to_kset(o2cb_kset)); if (ret) goto error; return 0; error: - kset_unregister(o2cb_kset); + kapi_kset_unregister(o2cb_kset); return ret; } diff --git a/fs/ocfs2/compat_kobject.c b/fs/ocfs2/compat_kobject.c new file mode 100644 index 0000000..fef1fd9 --- /dev/null +++ b/fs/ocfs2/compat_kobject.c @@ -0,0 +1,90 @@ +#include +#include + +/* default kobject attribute operations */ +static ssize_t kobj_attr_show(struct kobject *kobj, struct attribute *attr, + char *buf) +{ + struct kobj_attribute *kattr; + ssize_t ret = -EIO; + + kattr = container_of(attr, struct kobj_attribute, attr); + if (kattr->show) + ret = kattr->show(kobj, kattr, buf); + return ret; +} + +static ssize_t kobj_attr_store(struct kobject *kobj, struct attribute *attr, + const char *buf, size_t count) +{ + struct kobj_attribute *kattr; + ssize_t ret = -EIO; + + kattr = container_of(attr, struct kobj_attribute, attr); + if (kattr->store) + ret = kattr->store(kobj, kattr, buf, count); + return ret; +} + +static struct sysfs_ops kobj_sysfs_ops = { + .show = kobj_attr_show, + .store = kobj_attr_store, +}; + +static void dynamic_kobj_release(struct kobject *kobj) +{ + pr_debug("kobject: (%p): %s\n", kobj, __FUNCTION__); + kfree(kobj); +} + +static struct kobj_type dynamic_kobj_ktype = { + .release = dynamic_kobj_release, + .sysfs_ops = &kobj_sysfs_ops, +}; + +/** + * kobject_create_and_add - create a struct kobject dynamically and register it with sysfs + * + * @name: the name for the kset + * @parent: the parent kobject of this kobject, if any. + * + * This function creates a kobject structure dynamically and registers it + * with sysfs. When you are finished with this structure, call + * kobject_put() and the structure will be dynamically freed when + * it is no longer being used. + * + * If the kobject was not able to be created, NULL will be returned. + */ +struct kobject *kobject_create_and_add(const char *name, struct kobject *parent) +{ + struct kobject *kobj; + int retval; + + kobj = kzalloc(sizeof(*kobj), GFP_KERNEL); + if (!kobj) + return NULL; + + kobject_init(kobj); + kobj->ktype = &dynamic_kobj_ktype; + kobj->parent = parent; + + retval = kobject_set_name(kobj, "%s", name); + if (retval) { + printk(KERN_WARNING "%s: kobject_set_name error: %d\n", + __FUNCTION__, retval); + goto err; + } + + retval = kobject_add(kobj); + if (retval) { + printk(KERN_WARNING "%s: kobject_add error: %d\n", + __FUNCTION__, retval); + goto err; + } + + return kobj; + +err: + kobject_put(kobj); + return NULL; +} diff --git a/fs/ocfs2/kapi-default.h b/fs/ocfs2/kapi-default.h index 80f04ff..68e5746 100644 --- a/fs/ocfs2/kapi-default.h +++ b/fs/ocfs2/kapi-default.h @@ -69,4 +69,14 @@ typedef u64 f_version_t; # define kapi_filemap_fdatawait_range filemap_fdatawait_range #endif +#ifndef kapi_kset +# define kapi_kset kset +# define kapi_kset_create_and_add(a, b, c) kset_create_and_add(a, b, c) +# define kapi_kset_unregister(a) kset_unregister(a) +# define kapi_to_kobj(a) (&((a)->kobj)) +# define kapi_to_kset(a) (a) +# define kapi_sysfs_create_link(a, b, c) sysfs_create_link(a, b, c) +# define kapi_sysfs_remove_link(a, b) sysfs_remove_link(a, b) +#endif + #endif diff --git a/fs/ocfs2/stackglue.c b/fs/ocfs2/stackglue.c index b4c85be..02ba5b5 100644 --- a/fs/ocfs2/stackglue.c +++ b/fs/ocfs2/stackglue.c @@ -582,29 +582,29 @@ static struct attribute_group ocfs2_attr_group = { .attrs = ocfs2_attrs, }; -static struct kset *ocfs2_kset; +static struct kapi_kset *ocfs2_kset; static void ocfs2_sysfs_exit(void) { - kset_unregister(ocfs2_kset); + kapi_kset_unregister(ocfs2_kset); } static int ocfs2_sysfs_init(void) { int ret; - ocfs2_kset = kset_create_and_add("ocfs2", NULL, fs_kobj); + ocfs2_kset = kapi_kset_create_and_add("ocfs2", NULL, fs_kobj); if (!ocfs2_kset) return -ENOMEM; - ret = sysfs_create_group(&ocfs2_kset->kobj, &ocfs2_attr_group); + ret = sysfs_create_group(kapi_to_kobj(ocfs2_kset), &ocfs2_attr_group); if (ret) goto error; return 0; error: - kset_unregister(ocfs2_kset); + kapi_kset_unregister(ocfs2_kset); return ret; } diff --git a/kapi-compat/include/compat_kobject.h b/kapi-compat/include/compat_kobject.h new file mode 100644 index 0000000..441b3c6 --- /dev/null +++ b/kapi-compat/include/compat_kobject.h @@ -0,0 +1,29 @@ +#ifndef KAPI_COMPAT_KOBJECT_H +#define KAPI_COMPAT_KOBJECT_H + +#ifdef NO_KOBJ_ATTRIBUTE + +#include +#include + +#define kapi_kset kobject +#define kapi_kset_create_and_add(a, b, c) kobject_create_and_add(a, b) +#define kapi_kset_unregister(a) kobject_unregister(a) +#define kapi_to_kobj(a) (a) +#define kapi_to_kset(a) ((a)->kset) +#define kapi_sysfs_create_link(a, b, c) 0 +#define kapi_sysfs_remove_link(a, b) + +struct kobj_attribute { + struct attribute attr; + ssize_t (*show)(struct kobject *kobj, struct kobj_attribute *attr, + char *buf); + ssize_t (*store)(struct kobject *kobj, struct kobj_attribute *attr, + const char *buf, size_t count); +}; + +struct kobject *kobject_create_and_add(const char *name, struct kobject *parent); + +#endif + +#endif -- 1.5.6.5 From sunil.mushran at oracle.com Fri Nov 20 17:12:47 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Fri, 20 Nov 2009 17:12:47 -0800 Subject: [Ocfs2-devel] ocfs2 1.6 - sixth set Message-ID: <1258765977-4334-1-git-send-email-sunil.mushran@oracle.com> All previous patches have been pushed to the git repo. With this set, we can start building the fs on el5 u4. More importantly, the testing can begin. Yes, this set disables few features. But that is only temporary. Details are provided in the specific patches. Sunil From sunil.mushran at oracle.com Fri Nov 20 17:12:57 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Fri, 20 Nov 2009 17:12:57 -0800 Subject: [Ocfs2-devel] [PATCH 10/10] ocfs2: Handle missing cancel_work_sync() In-Reply-To: <1258765977-4334-1-git-send-email-sunil.mushran@oracle.com> References: <1258765977-4334-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1258765977-4334-11-git-send-email-sunil.mushran@oracle.com> Mainline commit 28e53bddf814485699a4142bc056fd37d4e11dd4 added helper cancel_work_sync(). The patch adds a helper with the same name that cancels pending work and flushes the workqueues. Signed-off-by: Sunil Mushran --- Makefile | 3 ++- configure.in | 5 +++++ kapi-compat/include/cancel_work_sync.h | 14 ++++++++++++++ 3 files changed, 21 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/cancel_work_sync.h diff --git a/Makefile b/Makefile index 07adc70..f285238 100644 --- a/Makefile +++ b/Makefile @@ -40,7 +40,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/hardsect.h \ kapi-compat/include/triggers.h \ kapi-compat/include/compat_kobject.h \ - kapi-compat/include/quotas.h + kapi-compat/include/quotas.h \ + kapi-compat/include/cancel_work_sync.h PATCH_FILES = diff --git a/configure.in b/configure.in index 9913820..405e1a5 100644 --- a/configure.in +++ b/configure.in @@ -454,6 +454,11 @@ KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $SKIP_QUOTAS" SKIP_EXPORTS=yes +cancel_work_sync_header= +OCFS2_CHECK_KERNEL([cancel_work_sync() in workqueue.h], workqueue.h, + , cancel_work_sync_header=cancel_work_sync.h, [extern int cancel_work_sync(struct work_struct]) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $cancel_work_sync_header" + # End kapi_compat checks # using -include has two advantages: diff --git a/kapi-compat/include/cancel_work_sync.h b/kapi-compat/include/cancel_work_sync.h new file mode 100644 index 0000000..226362e --- /dev/null +++ b/kapi-compat/include/cancel_work_sync.h @@ -0,0 +1,14 @@ +#ifndef KAPI_CANCEL_WORK_SYNC_H +#define KAPI_CANCEL_WORK_SYNC_H + +static inline int cancel_work_sync(struct work_struct *work) +{ + int ret; + + ret = cancel_delayed_work(work); + if (!ret) + flush_scheduled_work(); + return ret; +} + +#endif -- 1.5.6.5 From sunil.mushran at oracle.com Fri Nov 20 17:12:52 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Fri, 20 Nov 2009 17:12:52 -0800 Subject: [Ocfs2-devel] [PATCH 05/10] ocfs2: Handle missing struct jbd2_buffer_trigger_type In-Reply-To: <1258765977-4334-1-git-send-email-sunil.mushran@oracle.com> References: <1258765977-4334-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1258765977-4334-6-git-send-email-sunil.mushran@oracle.com> Mainline commit e06c8227fd94ec181849ba206bf032be31c4295c added buffer commit triggers in JBD2. OCFS2 uses these triggers to calculate the metadata checksums. Patch disables the MetaECC feature temporarily. TODO: Pull JBD2 source in OCFS2 1.6 repo and re-enable the MetaECC feature. Signed-off-by: Sunil Mushran --- Config.make.in | 1 + Makefile | 3 +- configure.in | 6 +++ fs/ocfs2/Makefile | 4 ++ fs/ocfs2/journal.c | 2 + fs/ocfs2/super.c | 9 +++++ kapi-compat/include/triggers.h | 72 ++++++++++++++++++++++++++++++++++++++++ 7 files changed, 96 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/triggers.h diff --git a/Config.make.in b/Config.make.in index a2365e4..5a81e44 100644 --- a/Config.make.in +++ b/Config.make.in @@ -79,6 +79,7 @@ GET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN = @GET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN@ NO_SHOULD_REMOVE_SUID = @NO_SHOULD_REMOVE_SUID@ HAS_FOPS_SENDFILE = @HAS_FOPS_SENDFILE@ SKIP_SPLICE = @SKIP_SPLICE@ +SKIP_BUFFER_TRIGGERS = @SKIP_BUFFER_TRIGGERS@ OCFS_DEBUG = @OCFS_DEBUG@ diff --git a/Makefile b/Makefile index 8e8b63f..fd34d67 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/user_path_at.h \ kapi-compat/include/filemap_fdatawait_range.h \ kapi-compat/include/mnt_want_write.h \ - kapi-compat/include/hardsect.h + kapi-compat/include/hardsect.h \ + kapi-compat/include/triggers.h PATCH_FILES = diff --git a/configure.in b/configure.in index 2826cec..d042f9c 100644 --- a/configure.in +++ b/configure.in @@ -429,6 +429,12 @@ OCFS2_CHECK_KERNEL([ bdev_hardsect_size() in blkdev.h], blkdev.h, bdev_hardsect_header=hardsect.h, , [static inline int bdev_hardsect_size(struct block_device \*bdev)]) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $bdev_hardsect_header" +SKIP_BUFFER_TRIGGERS= +OCFS2_CHECK_KERNEL([struct jbd2_buffer_trigger_type in jbd2.h], jbd2.h, + , SKIP_BUFFER_TRIGGERS=triggers.h, [^struct jbd2_buffer_trigger_type {]) +AC_SUBST(SKIP_BUFFER_TRIGGERS) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $SKIP_BUFFER_TRIGGERS" + # End kapi_compat checks # using -include has two advantages: diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile index ba2a3ea..1e8fed6 100644 --- a/fs/ocfs2/Makefile +++ b/fs/ocfs2/Makefile @@ -118,6 +118,10 @@ ifdef SKIP_SPLICE EXTRA_CFLAGS += -DSKIP_SPLICE endif +ifdef SKIP_BUFFER_TRIGGERS +CFLAGS_journal.o += -DSKIP_BUFFER_TRIGGERS +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes. diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c index 67cc5a7..217f30a 100644 --- a/fs/ocfs2/journal.c +++ b/fs/ocfs2/journal.c @@ -459,6 +459,7 @@ bail: return status; } +#ifndef SKIP_BUFFER_TRIGGERS struct ocfs2_triggers { struct jbd2_buffer_trigger_type ot_triggers; int ot_offset; @@ -608,6 +609,7 @@ static struct ocfs2_triggers dl_triggers = { }, .ot_offset = offsetof(struct ocfs2_dx_leaf, dl_check), }; +#endif /* SKIP_BUFFER_TRIGGERS */ static int __ocfs2_journal_access(handle_t *handle, struct ocfs2_caching_info *ci, diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index e36bec2..0a7a621 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c @@ -1017,6 +1017,15 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) brelse(bh); bh = NULL; +#ifdef SKIP_BUFFER_TRIGGERS + if(ocfs2_meta_ecc(osb)) { + status = -EINVAL; + mlog(ML_ERROR, "File system cannot mount volume with the " + "MetaECC feature enabled.\n"); + goto read_super_error; + } +#endif + if (!(osb->s_feature_incompat & OCFS2_FEATURE_INCOMPAT_XATTR)) parsed_options.mount_opt &= ~OCFS2_MOUNT_POSIX_ACL; diff --git a/kapi-compat/include/triggers.h b/kapi-compat/include/triggers.h new file mode 100644 index 0000000..d9f3f3f --- /dev/null +++ b/kapi-compat/include/triggers.h @@ -0,0 +1,72 @@ +#ifndef KAPI_TRIGGERS_H +#define KAPI_TRIGGERS_H + +#ifdef SKIP_BUFFER_TRIGGERS + +#include +#include + +struct jbd2_buffer_trigger_type { + /* + * Fired just before a buffer is written to the journal. + * mapped_data is a mapped buffer that is the frozen data for + * commit. + */ + void (*t_commit)(struct jbd2_buffer_trigger_type *type, + struct buffer_head *bh, void *mapped_data, + size_t size); + + /* + * Fired during journal abort for dirty buffers that will not be + * committed. + */ + void (*t_abort)(struct jbd2_buffer_trigger_type *type, + struct buffer_head *bh); +}; + +struct ocfs2_triggers { + struct jbd2_buffer_trigger_type ot_triggers; + int ot_offset; +}; + +#define jbd2_journal_set_triggers(a, b) do { } while (0) + +static struct ocfs2_triggers di_triggers = { + .ot_triggers = { .t_commit = NULL, .t_abort = NULL, }, .ot_offset = 0, +}; + +static struct ocfs2_triggers eb_triggers = { + .ot_triggers = { .t_commit = NULL, .t_abort = NULL, }, .ot_offset = 0, +}; + +static struct ocfs2_triggers rb_triggers = { + .ot_triggers = { .t_commit = NULL, .t_abort = NULL, }, .ot_offset = 0, +}; + +static struct ocfs2_triggers gd_triggers = { + .ot_triggers = { .t_commit = NULL, .t_abort = NULL, }, .ot_offset = 0, +}; + +static struct ocfs2_triggers db_triggers = { + .ot_triggers = { .t_commit = NULL, .t_abort = NULL, }, .ot_offset = 0, +}; + +static struct ocfs2_triggers xb_triggers = { + .ot_triggers = { .t_commit = NULL, .t_abort = NULL, }, .ot_offset = 0, +}; + +static struct ocfs2_triggers dq_triggers = { + .ot_triggers = { .t_commit = NULL, .t_abort = NULL, }, .ot_offset = 0, +}; + +static struct ocfs2_triggers dr_triggers = { + .ot_triggers = { .t_commit = NULL, .t_abort = NULL, }, .ot_offset = 0, +}; + +static struct ocfs2_triggers dl_triggers = { + .ot_triggers = { .t_commit = NULL, .t_abort = NULL, }, .ot_offset = 0, +}; + +#endif + +#endif -- 1.5.6.5 From sunil.mushran at oracle.com Fri Nov 20 17:12:50 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Fri, 20 Nov 2009 17:12:50 -0800 Subject: [Ocfs2-devel] [PATCH 03/10] ocfs2: Handle missing mnt_want_write() and mnt_drop_write() In-Reply-To: <1258765977-4334-1-git-send-email-sunil.mushran@oracle.com> References: <1258765977-4334-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1258765977-4334-4-git-send-email-sunil.mushran@oracle.com> Mainline commit 8366025eb80dfa0d8d94b286d53027081c280ef1 added mnt_want_write() and mnt_drop_write() to protect writes to a filesystem. This patch disables this functionality when built on older EL5 kernels. TODO: We should look into enabling this functionality for EL5. Signed-off-by: Sunil Mushran --- Makefile | 3 ++- configure.in | 5 +++++ kapi-compat/include/mnt_want_write.h | 7 +++++++ 3 files changed, 14 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/mnt_want_write.h diff --git a/Makefile b/Makefile index 7d9e0a9..a642c13 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/inode_permission.h \ kapi-compat/include/should_remove_suid.h \ kapi-compat/include/user_path_at.h \ - kapi-compat/include/filemap_fdatawait_range.h + kapi-compat/include/filemap_fdatawait_range.h \ + kapi-compat/include/mnt_want_write.h PATCH_FILES = diff --git a/configure.in b/configure.in index f028444..c9ddf88 100644 --- a/configure.in +++ b/configure.in @@ -419,6 +419,11 @@ OCFS2_CHECK_KERNEL([splice.h], splice.h, , SKIP_SPLICE=yes, [struct splice_desc {]) AC_SUBST(SKIP_SPLICE) +mnt_want_write= +OCFS2_CHECK_KERNEL([mnt_want_write.h() and mnt_drop_write() in mount.h], mount.h, + , mnt_want_write=mnt_want_write.h, [^extern int mnt_want_write(]) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $mnt_want_write" + # End kapi_compat checks # using -include has two advantages: diff --git a/kapi-compat/include/mnt_want_write.h b/kapi-compat/include/mnt_want_write.h new file mode 100644 index 0000000..2f234a8 --- /dev/null +++ b/kapi-compat/include/mnt_want_write.h @@ -0,0 +1,7 @@ +#ifndef KAPI_MNT_WANT_WRITE_H +#define KAPI_MNT_WANT_WRITE_H + +#define mnt_want_write(a) 0 +#define mnt_drop_write(a) + +#endif -- 1.5.6.5 From sunil.mushran at oracle.com Fri Nov 20 17:12:51 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Fri, 20 Nov 2009 17:12:51 -0800 Subject: [Ocfs2-devel] [PATCH 04/10] ocfs2: Handle missing bdev_logical_block_size() In-Reply-To: <1258765977-4334-1-git-send-email-sunil.mushran@oracle.com> References: <1258765977-4334-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1258765977-4334-5-git-send-email-sunil.mushran@oracle.com> Mainline commit e1defc4ff0cf57aca6c5e3ff99fa503f5943c1f1 does away with the notion of hardsect_size and replaces it with physical and logical block sizes. This patch adds a macro to plumb the new bdev_logical_block_size() to the old bdev_hardsect_size() when building on EL5. Signed-off-by: Sunil Mushran --- Makefile | 3 ++- configure.in | 5 +++++ kapi-compat/include/hardsect.h | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/hardsect.h diff --git a/Makefile b/Makefile index a642c13..8e8b63f 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/should_remove_suid.h \ kapi-compat/include/user_path_at.h \ kapi-compat/include/filemap_fdatawait_range.h \ - kapi-compat/include/mnt_want_write.h + kapi-compat/include/mnt_want_write.h \ + kapi-compat/include/hardsect.h PATCH_FILES = diff --git a/configure.in b/configure.in index c9ddf88..2826cec 100644 --- a/configure.in +++ b/configure.in @@ -424,6 +424,11 @@ OCFS2_CHECK_KERNEL([mnt_want_write.h() and mnt_drop_write() in mount.h], mount.h , mnt_want_write=mnt_want_write.h, [^extern int mnt_want_write(]) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $mnt_want_write" +bdev_hardsect_header= +OCFS2_CHECK_KERNEL([ bdev_hardsect_size() in blkdev.h], blkdev.h, + bdev_hardsect_header=hardsect.h, , [static inline int bdev_hardsect_size(struct block_device \*bdev)]) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $bdev_hardsect_header" + # End kapi_compat checks # using -include has two advantages: diff --git a/kapi-compat/include/hardsect.h b/kapi-compat/include/hardsect.h new file mode 100644 index 0000000..7c59c00 --- /dev/null +++ b/kapi-compat/include/hardsect.h @@ -0,0 +1,6 @@ +#ifndef KAPI_HARDSECT_H +#define KAPI_HARDSECT_H + +#define bdev_logical_block_size(a) bdev_hardsect_size(a) + +#endif -- 1.5.6.5 From sunil.mushran at oracle.com Fri Nov 20 17:12:56 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Fri, 20 Nov 2009 17:12:56 -0800 Subject: [Ocfs2-devel] [PATCH 09/10] ocfs2: Temporarily disable NFS exports In-Reply-To: <1258765977-4334-1-git-send-email-sunil.mushran@oracle.com> References: <1258765977-4334-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1258765977-4334-10-git-send-email-sunil.mushran@oracle.com> We have no intention of disabling NFS exports in OCFS2 1.6. However, writing a clean patch to enable it in EL5 will take sometime. This is being done only because we want to start testing the fs now. TODO: Enable NFS exports Signed-off-by: Sunil Mushran --- Config.make.in | 1 + configure.in | 2 ++ fs/ocfs2/Makefile | 4 ++++ fs/ocfs2/export.c | 4 ++++ fs/ocfs2/export.h | 3 +++ fs/ocfs2/super.c | 2 ++ 6 files changed, 16 insertions(+), 0 deletions(-) diff --git a/Config.make.in b/Config.make.in index 8675982..acbe8fd 100644 --- a/Config.make.in +++ b/Config.make.in @@ -83,6 +83,7 @@ SKIP_BUFFER_TRIGGERS = @SKIP_BUFFER_TRIGGERS@ NO_NAME_IN_BACKING_DEV_INFO=@NO_NAME_IN_BACKING_DEV_INFO@ NO_KOBJ_ATTRIBUTE = @NO_KOBJ_ATTRIBUTE@ SKIP_QUOTAS= @SKIP_QUOTAS@ +SKIP_EXPORTS= @SKIP_EXPORTS@ OCFS_DEBUG = @OCFS_DEBUG@ diff --git a/configure.in b/configure.in index 3dfe596..9913820 100644 --- a/configure.in +++ b/configure.in @@ -452,6 +452,8 @@ OCFS2_CHECK_KERNEL([new quota format in dqblk_qtree.h], dqblk_qtree.h, AC_SUBST(SKIP_QUOTAS) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $SKIP_QUOTAS" +SKIP_EXPORTS=yes + # End kapi_compat checks # using -include has two advantages: diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile index 7a03c94..848c121 100644 --- a/fs/ocfs2/Makefile +++ b/fs/ocfs2/Makefile @@ -132,6 +132,10 @@ ifdef SKIP_QUOTAS EXTRA_CFLAGS += -DSKIP_QUOTAS endif +ifdef SKIP_EXPORTS +EXTRA_CFLAGS += -DSKIP_EXPORTS +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes. diff --git a/fs/ocfs2/export.c b/fs/ocfs2/export.c index fce7d23..e2a584f 100644 --- a/fs/ocfs2/export.c +++ b/fs/ocfs2/export.c @@ -23,6 +23,8 @@ * Boston, MA 021110-1307, USA. */ +#ifndef SKIP_EXPORTS + #include #include @@ -285,3 +287,5 @@ const struct export_operations ocfs2_export_ops = { .fh_to_parent = ocfs2_fh_to_parent, .get_parent = ocfs2_get_parent, }; + +#endif /* SKIP_EXPORTS */ diff --git a/fs/ocfs2/export.h b/fs/ocfs2/export.h index 0707bf3..1f93127 100644 --- a/fs/ocfs2/export.h +++ b/fs/ocfs2/export.h @@ -26,6 +26,8 @@ #ifndef OCFS2_EXPORT_H #define OCFS2_EXPORT_H +#ifndef SKIP_EXPORTS + #include #ifdef EXPORTOP_IS_NOT_CONST @@ -34,4 +36,5 @@ extern struct export_operations ocfs2_export_ops; extern const struct export_operations ocfs2_export_ops; #endif +#endif #endif /* OCFS2_EXPORT_H */ diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 5092558..f6e2c69 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c @@ -2006,7 +2006,9 @@ static int ocfs2_initialize_super(struct super_block *sb, sb->s_fs_info = osb; sb->s_op = &ocfs2_sops; +#ifndef SKIP_EXPORTS sb->s_export_op = &ocfs2_export_ops; +#endif #ifndef SKIP_QUOTAS sb->s_qcop = &ocfs2_quotactl_ops; sb->dq_op = &ocfs2_quota_operations; -- 1.5.6.5 From sunil.mushran at oracle.com Fri Nov 20 17:12:55 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Fri, 20 Nov 2009 17:12:55 -0800 Subject: [Ocfs2-devel] [PATCH 08/10] ocfs2: Handle missing new quota format In-Reply-To: <1258765977-4334-1-git-send-email-sunil.mushran@oracle.com> References: <1258765977-4334-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1258765977-4334-9-git-send-email-sunil.mushran@oracle.com> Mainline commit 1ccd14b9c271c1ac6eec5c5ec5def433100e7248 changed the quota format. This patch disables enabling the quotas feature when built on the older EL5 kernel. Changes introduced by mainline commits b85f4b87a511bea86dac68c4f0fabaee2cac6c4c and e3d4d56b9715e40ded2a84d0d4fa7f3b6c58983c were also handled in this patch. Signed-off-by: Sunil Mushran --- Config.make.in | 1 + Makefile | 3 ++- configure.in | 6 ++++++ fs/ocfs2/Makefile | 4 ++++ fs/ocfs2/dlmglue.c | 15 ++++++++++++--- fs/ocfs2/file.c | 10 ++++++++-- fs/ocfs2/journal.c | 17 +++++++++++++++++ fs/ocfs2/quota.h | 25 +++++++++++++++++++++++++ fs/ocfs2/quota_global.c | 3 +++ fs/ocfs2/quota_local.c | 3 +++ fs/ocfs2/super.c | 22 ++++++++++++++++++++++ kapi-compat/include/quotas.h | 19 +++++++++++++++++++ 12 files changed, 122 insertions(+), 6 deletions(-) create mode 100644 kapi-compat/include/quotas.h diff --git a/Config.make.in b/Config.make.in index dd2e406..8675982 100644 --- a/Config.make.in +++ b/Config.make.in @@ -82,6 +82,7 @@ SKIP_SPLICE = @SKIP_SPLICE@ SKIP_BUFFER_TRIGGERS = @SKIP_BUFFER_TRIGGERS@ NO_NAME_IN_BACKING_DEV_INFO=@NO_NAME_IN_BACKING_DEV_INFO@ NO_KOBJ_ATTRIBUTE = @NO_KOBJ_ATTRIBUTE@ +SKIP_QUOTAS= @SKIP_QUOTAS@ OCFS_DEBUG = @OCFS_DEBUG@ diff --git a/Makefile b/Makefile index 7c48788..07adc70 100644 --- a/Makefile +++ b/Makefile @@ -39,7 +39,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/mnt_want_write.h \ kapi-compat/include/hardsect.h \ kapi-compat/include/triggers.h \ - kapi-compat/include/compat_kobject.h + kapi-compat/include/compat_kobject.h \ + kapi-compat/include/quotas.h PATCH_FILES = diff --git a/configure.in b/configure.in index 22245ec..3dfe596 100644 --- a/configure.in +++ b/configure.in @@ -446,6 +446,12 @@ OCFS2_CHECK_KERNEL([struct kobj_attribute in kobject.h], kobject.h, AC_SUBST(NO_KOBJ_ATTRIBUTE) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $NO_KOBJ_ATTRIBUTE" +SKIP_QUOTAS= +OCFS2_CHECK_KERNEL([new quota format in dqblk_qtree.h], dqblk_qtree.h, + , SKIP_QUOTAS=quotas.h, [#define QTREE_INIT_ALLOC]) +AC_SUBST(SKIP_QUOTAS) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $SKIP_QUOTAS" + # End kapi_compat checks # using -include has two advantages: diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile index c02cbee..7a03c94 100644 --- a/fs/ocfs2/Makefile +++ b/fs/ocfs2/Makefile @@ -128,6 +128,10 @@ FS_SOURCES += compat_kobject.c EXTRA_CFLAGS += -DNO_KOBJ_ATTRIBUTE endif +ifdef SKIP_QUOTAS +EXTRA_CFLAGS += -DSKIP_QUOTAS +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes. diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c index 0b73382..dab6b8e 100644 --- a/fs/ocfs2/dlmglue.c +++ b/fs/ocfs2/dlmglue.c @@ -71,7 +71,9 @@ struct ocfs2_mask_waiter { static struct ocfs2_super *ocfs2_get_dentry_osb(struct ocfs2_lock_res *lockres); static struct ocfs2_super *ocfs2_get_inode_osb(struct ocfs2_lock_res *lockres); static struct ocfs2_super *ocfs2_get_file_osb(struct ocfs2_lock_res *lockres); +#ifndef SKIP_QUOTAS static struct ocfs2_super *ocfs2_get_qinfo_osb(struct ocfs2_lock_res *lockres); +#endif /* * Return value from ->downconvert_worker functions. @@ -108,8 +110,9 @@ static int ocfs2_dentry_convert_worker(struct ocfs2_lock_res *lockres, static void ocfs2_dentry_post_unlock(struct ocfs2_super *osb, struct ocfs2_lock_res *lockres); - +#ifndef SKIP_QUOTAS static void ocfs2_set_qinfo_lvb(struct ocfs2_lock_res *lockres); +#endif static int ocfs2_check_refcount_downconvert(struct ocfs2_lock_res *lockres, int new_level); @@ -277,13 +280,13 @@ static struct ocfs2_lock_res_ops ocfs2_flock_lops = { .get_osb = ocfs2_get_file_osb, .flags = 0, }; - +#ifndef SKIP_QUOTAS static struct ocfs2_lock_res_ops ocfs2_qinfo_lops = { .set_lvb = ocfs2_set_qinfo_lvb, .get_osb = ocfs2_get_qinfo_osb, .flags = LOCK_TYPE_REQUIRES_REFRESH | LOCK_TYPE_USES_LVB, }; - +#endif static struct ocfs2_lock_res_ops ocfs2_refcount_block_lops = { .check_downconvert = ocfs2_check_refcount_downconvert, .downconvert_worker = ocfs2_refcount_convert_worker, @@ -571,12 +574,14 @@ static struct ocfs2_super *ocfs2_get_inode_osb(struct ocfs2_lock_res *lockres) return OCFS2_SB(inode->i_sb); } +#ifndef SKIP_QUOTAS static struct ocfs2_super *ocfs2_get_qinfo_osb(struct ocfs2_lock_res *lockres) { struct ocfs2_mem_dqinfo *info = lockres->l_priv; return OCFS2_SB(info->dqi_gi.dqi_sb); } +#endif static struct ocfs2_super *ocfs2_get_file_osb(struct ocfs2_lock_res *lockres) { @@ -700,6 +705,7 @@ void ocfs2_file_lock_res_init(struct ocfs2_lock_res *lockres, lockres->l_flags |= OCFS2_LOCK_NOCACHE; } +#ifndef SKIP_QUOTAS void ocfs2_qinfo_lock_res_init(struct ocfs2_lock_res *lockres, struct ocfs2_mem_dqinfo *info) { @@ -710,6 +716,7 @@ void ocfs2_qinfo_lock_res_init(struct ocfs2_lock_res *lockres, OCFS2_LOCK_TYPE_QINFO, &ocfs2_qinfo_lops, info); } +#endif void ocfs2_refcount_lock_res_init(struct ocfs2_lock_res *lockres, struct ocfs2_super *osb, u64 ref_blkno, @@ -3704,6 +3711,7 @@ static int ocfs2_refcount_convert_worker(struct ocfs2_lock_res *lockres, return UNBLOCK_CONTINUE; } +#ifndef SKIP_QUOTAS static void ocfs2_set_qinfo_lvb(struct ocfs2_lock_res *lockres) { struct ocfs2_qinfo_lvb *lvb; @@ -3815,6 +3823,7 @@ bail: mlog_exit(status); return status; } +#endif /* SKIP_QUOTAS */ int ocfs2_refcount_lock(struct ocfs2_refcount_tree *ref_tree, int ex) { diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 81bd622..c729d7c 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c @@ -945,9 +945,11 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr) struct ocfs2_super *osb = OCFS2_SB(sb); struct buffer_head *bh = NULL; handle_t *handle = NULL; +#ifndef SKIP_QUOTAS int qtype; struct dquot *transfer_from[MAXQUOTAS] = { }; struct dquot *transfer_to[MAXQUOTAS] = { }; +#endif mlog_entry("(0x%p, '%.*s')\n", dentry, dentry->d_name.len, dentry->d_name.name); @@ -1017,7 +1019,7 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr) goto bail_unlock; } } - +#ifndef SKIP_QUOTAS if ((attr->ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) || (attr->ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) { /* @@ -1060,6 +1062,9 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr) if (status < 0) goto bail_commit; } else { +#else + { +#endif /* SKIP_QUOTAS */ handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); if (IS_ERR(handle)) { status = PTR_ERR(handle); @@ -1095,12 +1100,13 @@ bail_unlock_rw: bail: brelse(bh); +#ifndef SKIP_QUOTAS /* Release quota pointers in case we acquired them */ for (qtype = 0; qtype < MAXQUOTAS; qtype++) { dqput(transfer_to[qtype]); dqput(transfer_from[qtype]); } - +#endif if (!status && attr->ia_valid & ATTR_MODE) { status = ocfs2_acl_chmod(inode); if (status < 0) diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c index 217f30a..ab69048 100644 --- a/fs/ocfs2/journal.c +++ b/fs/ocfs2/journal.c @@ -1199,7 +1199,9 @@ void ocfs2_complete_recovery(kapi_work_struct_t *work) struct ocfs2_super *osb = journal->j_osb; struct ocfs2_dinode *la_dinode, *tl_dinode; struct ocfs2_la_recovery_item *item, *n; +#ifndef SKIP_QUOTAS struct ocfs2_quota_recovery *qrec; +#endif LIST_HEAD(tmp_la_list); mlog_entry_void(); @@ -1247,6 +1249,7 @@ void ocfs2_complete_recovery(kapi_work_struct_t *work) if (ret < 0) mlog_errno(ret); +#ifndef SKIP_QUOTAS qrec = item->lri_qrec; if (qrec) { mlog(0, "Recovering quota files"); @@ -1256,6 +1259,7 @@ void ocfs2_complete_recovery(kapi_work_struct_t *work) mlog_errno(ret); /* Recovery info is already freed now */ } +#endif kfree(item); } @@ -1286,8 +1290,10 @@ static void ocfs2_queue_recovery_completion(struct ocfs2_journal *journal, if (tl_dinode) kfree(tl_dinode); +#ifndef SKIP_QUOTAS if (qrec) ocfs2_free_quota_recovery(qrec); +#endif mlog_errno(-ENOMEM); return; @@ -1343,9 +1349,11 @@ static int __ocfs2_recovery_thread(void *arg) int status, node_num, slot_num; struct ocfs2_super *osb = arg; struct ocfs2_recovery_map *rm = osb->recovery_map; +#ifndef SKIP_QUOTAS int *rm_quota = NULL; int rm_quota_used = 0, i; struct ocfs2_quota_recovery *qrec; +#endif mlog_entry_void(); @@ -1354,11 +1362,14 @@ static int __ocfs2_recovery_thread(void *arg) goto bail; } +#ifndef SKIP_QUOTAS rm_quota = kzalloc(osb->max_slots * sizeof(int), GFP_NOFS); if (!rm_quota) { status = -ENOMEM; goto bail; } +#endif + restart: status = ocfs2_super_lock(osb, 1); if (status < 0) { @@ -1390,6 +1401,7 @@ restart: } mlog(0, "node %d was using slot %d\n", node_num, slot_num); +#ifndef SKIP_QUOTAS /* It is a bit subtle with quota recovery. We cannot do it * immediately because we have to obtain cluster locks from * quota files and we also don't want to just skip it because @@ -1399,6 +1411,7 @@ restart: for (i = 0; i < rm_quota_used && rm_quota[i] != slot_num; i++); if (i == rm_quota_used) rm_quota[rm_quota_used++] = slot_num; +#endif status = ocfs2_recover_node(osb, node_num, slot_num); skip_recovery: @@ -1423,6 +1436,7 @@ skip_recovery: if (status < 0) mlog_errno(status); +#ifndef SKIP_QUOTAS /* Now it is right time to recover quotas... We have to do this under * superblock lock so that noone can start using the slot (and crash) * before we recover it */ @@ -1436,6 +1450,7 @@ skip_recovery: ocfs2_queue_recovery_completion(osb->journal, rm_quota[i], NULL, NULL, qrec); } +#endif ocfs2_super_unlock(osb, 1); @@ -1456,8 +1471,10 @@ bail: mutex_unlock(&osb->recovery_lock); +#ifndef SKIP_QUOTAS if (rm_quota) kfree(rm_quota); +#endif mlog_exit(status); /* no one is callint kthread_stop() for us so the kthread() api diff --git a/fs/ocfs2/quota.h b/fs/ocfs2/quota.h index e5df9d1..a6c99de 100644 --- a/fs/ocfs2/quota.h +++ b/fs/ocfs2/quota.h @@ -9,6 +9,8 @@ #ifndef _OCFS2_QUOTA_H #define _OCFS2_QUOTA_H +#ifndef SKIP_QUOTAS + #include #include #include @@ -115,4 +117,27 @@ extern struct quota_format_type ocfs2_quota_format; int ocfs2_quota_setup(void); void ocfs2_quota_shutdown(void); +#else /* SKIP_QUOTAS */ + +struct ocfs2_dquot { + unsigned long dummy; +}; + +struct ocfs2_quota_recovery { + struct list_head r_list[MAXQUOTAS]; /* List of chunks to recover */ +}; + +struct ocfs2_quota_chunk { + unsigned long dummy; +}; + +struct ocfs2_quota_recovery *ocfs2_begin_quota_recovery( + struct ocfs2_super *osb, int slot_num); +int ocfs2_finish_quota_recovery(struct ocfs2_super *osb, + struct ocfs2_quota_recovery *rec, + int slot_num); +void ocfs2_free_quota_recovery(struct ocfs2_quota_recovery *rec); + +#endif /* SKIP_QUOTAS */ + #endif /* _OCFS2_QUOTA_H */ diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c index 0f319fb..24e127a 100644 --- a/fs/ocfs2/quota_global.c +++ b/fs/ocfs2/quota_global.c @@ -1,6 +1,8 @@ /* * Implementation of operations over global quota file */ + +#ifndef SKIP_QUOTAS #include #include #include @@ -883,3 +885,4 @@ void ocfs2_quota_shutdown(void) ocfs2_quota_wq = NULL; } } +#endif /* SKIP_QUOTAS */ diff --git a/fs/ocfs2/quota_local.c b/fs/ocfs2/quota_local.c index 1a2c50a..65399f8 100644 --- a/fs/ocfs2/quota_local.c +++ b/fs/ocfs2/quota_local.c @@ -2,6 +2,8 @@ * Implementation of operations over local quota file */ +#ifndef SKIP_QUOTAS + #include #include #include @@ -1340,3 +1342,4 @@ struct quota_format_type ocfs2_quota_format = { .qf_ops = &ocfs2_format_ops, .qf_owner = THIS_MODULE }; +#endif /* SKIP_QUOTAS */ diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 0a7a621..5092558 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c @@ -131,9 +131,11 @@ static int ocfs2_get_sector(struct super_block *sb, int sect_size); static struct inode *ocfs2_alloc_inode(struct super_block *sb); static void ocfs2_destroy_inode(struct inode *inode); +#ifndef SKIP_QUOTAS static int ocfs2_susp_quotas(struct ocfs2_super *osb, int unsuspend); static int ocfs2_enable_quotas(struct ocfs2_super *osb); static void ocfs2_disable_quotas(struct ocfs2_super *osb); +#endif #ifdef SOP_IS_NOT_CONST static struct super_operations ocfs2_sops = { @@ -150,8 +152,10 @@ static const struct super_operations ocfs2_sops = { .put_super = ocfs2_put_super, .remount_fs = ocfs2_remount, .show_options = ocfs2_show_options, +#ifndef SKIP_QUOTAS .quota_read = ocfs2_quota_read, .quota_write = ocfs2_quota_write, +#endif }; enum { @@ -679,6 +683,7 @@ static int ocfs2_remount(struct super_block *sb, int *flags, char *data) } unlock_osb: spin_unlock(&osb->osb_lock); +#ifndef SKIP_QUOTAS /* Enable quota accounting after remounting RW */ if (!ret && !(*flags & MS_RDONLY)) { if (sb_any_quota_suspended(sb)) @@ -694,6 +699,7 @@ unlock_osb: goto out; } } +#endif } if (!ret) { @@ -858,6 +864,7 @@ static int ocfs2_verify_userspace_stack(struct ocfs2_super *osb, return 0; } +#ifndef SKIP_QUOTAS static int ocfs2_susp_quotas(struct ocfs2_super *osb, int unsuspend) { int type; @@ -982,6 +989,7 @@ static const struct quotactl_ops ocfs2_quotactl_ops = { .get_dqblk = vfs_get_dqblk, .set_dqblk = vfs_set_dqblk, }; +#endif /* SKIP_QUOTAS */ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) { @@ -1026,6 +1034,16 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) } #endif +#ifdef SKIP_QUOTAS + if (OCFS2_HAS_RO_COMPAT_FEATURE(sb, OCFS2_FEATURE_RO_COMPAT_USRQUOTA) || + OCFS2_HAS_RO_COMPAT_FEATURE(sb, OCFS2_FEATURE_RO_COMPAT_GRPQUOTA)) { + status = -EINVAL; + mlog(ML_ERROR, "File system cannot mount volume with the Quotas" + "feature enabled.\n"); + goto read_super_error; + } +#endif + if (!(osb->s_feature_incompat & OCFS2_FEATURE_INCOMPAT_XATTR)) parsed_options.mount_opt &= ~OCFS2_MOUNT_POSIX_ACL; @@ -1181,6 +1199,7 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) atomic_set(&osb->vol_state, VOLUME_MOUNTED); wake_up(&osb->osb_mount_event); +#ifndef SKIP_QUOTAS /* Now we can initialize quotas because we can afford to wait * for cluster locks recovery now. That also means that truncation * log recovery can happen but that waits for proper quota setup */ @@ -1196,6 +1215,7 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) return status; } } +#endif ocfs2_complete_quota_recovery(osb); @@ -1987,8 +2007,10 @@ static int ocfs2_initialize_super(struct super_block *sb, sb->s_fs_info = osb; sb->s_op = &ocfs2_sops; sb->s_export_op = &ocfs2_export_ops; +#ifndef SKIP_QUOTAS sb->s_qcop = &ocfs2_quotactl_ops; sb->dq_op = &ocfs2_quota_operations; +#endif sb->s_xattr = ocfs2_xattr_handlers; sb->s_time_gran = 1; sb->s_flags |= MS_NOATIME; diff --git a/kapi-compat/include/quotas.h b/kapi-compat/include/quotas.h new file mode 100644 index 0000000..0f03805 --- /dev/null +++ b/kapi-compat/include/quotas.h @@ -0,0 +1,19 @@ +#ifndef KAPI_QUOTAS_H +#define KAPI_QUOTAS_H + +#define vfs_dq_alloc_space_nodirty DQUOT_ALLOC_SPACE_NODIRTY +#define vfs_dq_free_space_nodirty DQUOT_FREE_SPACE_NODIRTY +#define vfs_dq_transfer DQUOT_TRANSFER +#define vfs_dq_free_space DQUOT_FREE_SPACE +#define vfs_dq_free_inode DQUOT_FREE_INODE +#define vfs_dq_init DQUOT_INIT +#define register_quota_format(a) 0 +#define unregister_quota_format(a) +#define sb_any_quota_active(a) 0 +#define ocfs2_quota_shutdown() +#define ocfs2_quota_setup() 0 +#define ocfs2_disable_quotas(a) +#define ocfs2_susp_quotas(a, b) 0 + +#endif + -- 1.5.6.5 From sunil.mushran at oracle.com Fri Nov 20 17:12:53 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Fri, 20 Nov 2009 17:12:53 -0800 Subject: [Ocfs2-devel] [PATCH 06/10] ocfs2/dlm: Handle missing name in backing_dev_info In-Reply-To: <1258765977-4334-1-git-send-email-sunil.mushran@oracle.com> References: <1258765977-4334-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1258765977-4334-7-git-send-email-sunil.mushran@oracle.com> Mainline commit d993831fa7ffeb89e994f046f93eeb09ec91df08 added name in struct backing_dev_info. When built on older kernels, patch ifdefs out the name in the structure. Signed-off-by: Sunil Mushran --- Config.make.in | 1 + configure.in | 5 +++++ fs/ocfs2/dlm/Makefile | 4 ++++ fs/ocfs2/dlm/dlmfs.c | 2 ++ 4 files changed, 12 insertions(+), 0 deletions(-) diff --git a/Config.make.in b/Config.make.in index 5a81e44..0107e2e 100644 --- a/Config.make.in +++ b/Config.make.in @@ -80,6 +80,7 @@ NO_SHOULD_REMOVE_SUID = @NO_SHOULD_REMOVE_SUID@ HAS_FOPS_SENDFILE = @HAS_FOPS_SENDFILE@ SKIP_SPLICE = @SKIP_SPLICE@ SKIP_BUFFER_TRIGGERS = @SKIP_BUFFER_TRIGGERS@ +NO_NAME_IN_BACKING_DEV_INFO=@NO_NAME_IN_BACKING_DEV_INFO@ OCFS_DEBUG = @OCFS_DEBUG@ diff --git a/configure.in b/configure.in index d042f9c..0a3a356 100644 --- a/configure.in +++ b/configure.in @@ -435,6 +435,11 @@ OCFS2_CHECK_KERNEL([struct jbd2_buffer_trigger_type in jbd2.h], jbd2.h, AC_SUBST(SKIP_BUFFER_TRIGGERS) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $SKIP_BUFFER_TRIGGERS" +NO_NAME_IN_BACKING_DEV_INFO= +OCFS2_CHECK_KERNEL([name in backing-dev.h], backing-dev.h, + , NO_NAME_IN_BACKING_DEV_INFO=yes, [char.*\*name;$]) +AC_SUBST(NO_NAME_IN_BACKING_DEV_INFO) + # End kapi_compat checks # using -include has two advantages: diff --git a/fs/ocfs2/dlm/Makefile b/fs/ocfs2/dlm/Makefile index 907e390..f868c0e 100644 --- a/fs/ocfs2/dlm/Makefile +++ b/fs/ocfs2/dlm/Makefile @@ -46,6 +46,10 @@ ifdef KMEM_CACHE_CREATE_DTOR EXTRA_CFLAGS += -DKMEM_CACHE_CREATE_DTOR endif +ifdef NO_NAME_IN_BACKING_DEV_INFO +EXTRA_CFLAGS += -DNO_NAME_IN_BACKING_DEV_INFO +endif + DLM_SOURCES += \ dlmast.c \ dlmconvert.c \ diff --git a/fs/ocfs2/dlm/dlmfs.c b/fs/ocfs2/dlm/dlmfs.c index 6d97173..576d3ec 100644 --- a/fs/ocfs2/dlm/dlmfs.c +++ b/fs/ocfs2/dlm/dlmfs.c @@ -340,7 +340,9 @@ clear_fields: } static struct backing_dev_info dlmfs_backing_dev_info = { +#ifndef NO_NAME_IN_BACKING_DEV_INFO .name = "ocfs2-dlmfs", +#endif .ra_pages = 0, /* No readahead */ .capabilities = BDI_CAP_NO_ACCT_AND_WRITEBACK, }; -- 1.5.6.5 From sunil.mushran at oracle.com Fri Nov 20 17:12:48 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Fri, 20 Nov 2009 17:12:48 -0800 Subject: [Ocfs2-devel] [PATCH 01/10] ocfs2: Reduce stack usage in the vectorized io kapi patch In-Reply-To: <1258765977-4334-1-git-send-email-sunil.mushran@oracle.com> References: <1258765977-4334-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1258765977-4334-2-git-send-email-sunil.mushran@oracle.com> This patch improves changes in commit 1c87a8619515dba3a5a040daa272088b2cb90dc2 by reducing the stack footprint of the vectorized io kapi code. Signed-off-by: Sunil Mushran --- fs/ocfs2/kapi-default.h | 2 +- kapi-compat/include/aiovec.h | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/fs/ocfs2/kapi-default.h b/fs/ocfs2/kapi-default.h index b1afdcf..80f04ff 100644 --- a/fs/ocfs2/kapi-default.h +++ b/fs/ocfs2/kapi-default.h @@ -39,7 +39,7 @@ typedef struct work_struct kapi_work_struct_t; typedef u64 f_version_t; #endif -#ifndef kapi_generic_file_aio_read +#ifndef NO_VECTORIZED_AIO # define kapi_generic_file_aio_read(a, b, c, d) \ generic_file_aio_read(a, b, c, d) # define ocfs2_file_aio_read __ocfs2_file_aio_read diff --git a/kapi-compat/include/aiovec.h b/kapi-compat/include/aiovec.h index 0c4c312..a10d5b5 100644 --- a/kapi-compat/include/aiovec.h +++ b/kapi-compat/include/aiovec.h @@ -11,8 +11,9 @@ static ssize_t kapi_generic_file_aio_read(struct kiocb *iocb, unsigned long nr_segs, loff_t pos) { - BUG_ON(nr_segs != 1); - return generic_file_aio_read(iocb, iov->iov_base, iov->iov_len, pos); + BUG_ON(iocb->ki_pos != pos); + + return __generic_file_aio_read(iocb, iov, nr_segs, &pos); } static ssize_t __ocfs2_file_aio_read(struct kiocb *iocb, @@ -28,9 +29,8 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb, struct iovec iov_local = { .iov_base = (void __user *)buf, .iov_len = buflen }; const struct iovec *iov = &iov_local; - unsigned long nr_segs = 1; - return __ocfs2_file_aio_read(iocb, iov, nr_segs, pos); + return __ocfs2_file_aio_read(iocb, iov, 1, pos); } static ssize_t __ocfs2_file_aio_write(struct kiocb *iocb, @@ -46,10 +46,9 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb, struct iovec iov_local = { .iov_base = (void __user *)buf, .iov_len = buflen }; const struct iovec *iov = &iov_local; - unsigned long nr_segs = 1; iocb->ki_left = buflen; - return __ocfs2_file_aio_write(iocb, iov, nr_segs, pos); + return __ocfs2_file_aio_write(iocb, iov, 1, pos); } #endif -- 1.5.6.5 From sunil.mushran at oracle.com Fri Nov 20 17:25:29 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Fri, 20 Nov 2009 17:25:29 -0800 Subject: [Ocfs2-devel] [PATCH 1/1] ocfs2: return -EAGAIN instead of EAGAIN in dlm In-Reply-To: <1258597066-9227-1-git-send-email-tiger.yang@oracle.com> References: <4B0474A7.9020506@oracle.com> <1258597066-9227-1-git-send-email-tiger.yang@oracle.com> Message-ID: <4B074189.2050108@oracle.com> ack Tiger Yang wrote: > We used to return positive EAGAIN to indicate a retry action > is needed in dlm_begin_reco_handler(). Now we return negative > -EAGAIN to erase the confusion caused by this error code. > > Signed-off-by: Tiger Yang > --- > fs/ocfs2/dlm/dlmrecovery.c | 18 +++++++++--------- > 1 files changed, 9 insertions(+), 9 deletions(-) > > diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c > index d9fa3d2..2f9e4e1 100644 > --- a/fs/ocfs2/dlm/dlmrecovery.c > +++ b/fs/ocfs2/dlm/dlmrecovery.c > @@ -2589,6 +2589,14 @@ retry: > "begin reco msg (%d)\n", dlm->name, nodenum, ret); > ret = 0; > } > + if (ret == -EAGAIN) { > + mlog(0, "%s: trying to start recovery of node " > + "%u, but node %u is waiting for last recovery " > + "to complete, backoff for a bit\n", dlm->name, > + dead_node, nodenum); > + msleep(100); > + goto retry; > + } > if (ret < 0) { > struct dlm_lock_resource *res; > /* this is now a serious problem, possibly ENOMEM > @@ -2608,14 +2616,6 @@ retry: > * another ENOMEM */ > msleep(100); > goto retry; > - } else if (ret == EAGAIN) { > - mlog(0, "%s: trying to start recovery of node " > - "%u, but node %u is waiting for last recovery " > - "to complete, backoff for a bit\n", dlm->name, > - dead_node, nodenum); > - /* TODO Look into replacing msleep with cond_resched() */ > - msleep(100); > - goto retry; > } > } > > @@ -2639,7 +2639,7 @@ int dlm_begin_reco_handler(struct o2net_msg *msg, u32 len, void *data, > dlm->name, br->node_idx, br->dead_node, > dlm->reco.dead_node, dlm->reco.new_master); > spin_unlock(&dlm->spinlock); > - return EAGAIN; > + return -EAGAIN; > } > spin_unlock(&dlm->spinlock); > > From Joel.Becker at oracle.com Fri Nov 20 17:41:58 2009 From: Joel.Becker at oracle.com (Joel Becker) Date: Fri, 20 Nov 2009 17:41:58 -0800 Subject: [Ocfs2-devel] ocfs2 1.6 - sixth set In-Reply-To: <1258765977-4334-1-git-send-email-sunil.mushran@oracle.com> References: <1258765977-4334-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <20091121014158.GB15987@mail.oracle.com> On Fri, Nov 20, 2009 at 05:12:47PM -0800, Sunil Mushran wrote: > All previous patches have been pushed to the git repo. With this set, we > can start building the fs on el5 u4. More importantly, the testing can begin. > > Yes, this set disables few features. But that is only temporary. Details are > provided in the specific patches. It's yucky, but I know what you're doing. I hope we're going to be able to re-enable quotas? Acked Joel -- "What do you take me for, an idiot?" - General Charles de Gaulle, when a journalist asked him if he was happy. Joel Becker Principal Software Developer Oracle E-mail: joel.becker at oracle.com Phone: (650) 506-8127 From sunil.mushran at oracle.com Fri Nov 20 17:47:05 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Fri, 20 Nov 2009 17:47:05 -0800 Subject: [Ocfs2-devel] ocfs2 1.6 - sixth set In-Reply-To: <20091121014158.GB15987@mail.oracle.com> References: <1258765977-4334-1-git-send-email-sunil.mushran@oracle.com> <20091121014158.GB15987@mail.oracle.com> Message-ID: <4B074699.8090601@oracle.com> Joel Becker wrote: > It's yucky, but I know what you're doing. I hope we're going to > be able to re-enable quotas? > > I saved the yuck for last. ;) From sunil.mushran at oracle.com Fri Nov 20 17:46:31 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Fri, 20 Nov 2009 17:46:31 -0800 Subject: [Ocfs2-devel] ocfs2 1.6 - sixth set In-Reply-To: <20091121014158.GB15987@mail.oracle.com> References: <1258765977-4334-1-git-send-email-sunil.mushran@oracle.com> <20091121014158.GB15987@mail.oracle.com> Message-ID: <4B074677.9060102@oracle.com> Joel Becker wrote: > On Fri, Nov 20, 2009 at 05:12:47PM -0800, Sunil Mushran wrote: > > It's yucky, but I know what you're doing. I hope we're going to > be able to re-enable quotas? > > No. It requires extensive vfs changes. Quotas is the only feature we'll not be able to enable for el5. From srinivas.eeda at oracle.com Mon Nov 23 12:40:59 2009 From: srinivas.eeda at oracle.com (Srinivas Eeda) Date: Mon, 23 Nov 2009 12:40:59 -0800 Subject: [Ocfs2-devel] [PATCH] ocfs2: avoid panic for local mounts on corruptions Message-ID: <1259008859-27065-1-git-send-email-srinivas.eeda@oracle.com> When a file system is mounted local, it may be enough to remount it read only on seeing corruptions. Signed-off-by: Srinivas Eeda --- fs/ocfs2/super.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index a3f8871..c1ee5f0 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c @@ -2487,10 +2487,12 @@ void __ocfs2_abort(struct super_block* sb, * TODO: This should abort the journal and alert other nodes * that our slot needs recovery. */ - /* Force a panic(). This stinks, but it's better than letting - * things continue without having a proper hard readonly - * here. */ - OCFS2_SB(sb)->s_mount_opt |= OCFS2_MOUNT_ERRORS_PANIC; + /* Force a panic() for clustered mounts. This stinks, but it's + * better than letting things continue withouthaving a proper + * hard readonly here. + * */ + if (!ocfs2_mount_local(OCFS2_SB(sb))) + OCFS2_SB(sb)->s_mount_opt |= OCFS2_MOUNT_ERRORS_PANIC; ocfs2_handle_error(sb); } -- 1.5.6.5 From sunil.mushran at oracle.com Mon Nov 23 12:54:14 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Mon, 23 Nov 2009 12:54:14 -0800 Subject: [Ocfs2-devel] [PATCH] ocfs2: avoid panic for local mounts on corruptions In-Reply-To: <1259008859-27065-1-git-send-email-srinivas.eeda@oracle.com> References: <1259008859-27065-1-git-send-email-srinivas.eeda@oracle.com> Message-ID: <4B0AF676.3090405@oracle.com> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;h=a2f2ddbf2bafdbc7e4f3bbf09439b42c8fee2747 This change was pushed to mainline few months ago. Srinivas Eeda wrote: > When a file system is mounted local, it may be enough to remount it read only > on seeing corruptions. > > Signed-off-by: Srinivas Eeda > --- > fs/ocfs2/super.c | 10 ++++++---- > 1 files changed, 6 insertions(+), 4 deletions(-) > > diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c > index a3f8871..c1ee5f0 100644 > --- a/fs/ocfs2/super.c > +++ b/fs/ocfs2/super.c > @@ -2487,10 +2487,12 @@ void __ocfs2_abort(struct super_block* sb, > * TODO: This should abort the journal and alert other nodes > * that our slot needs recovery. */ > > - /* Force a panic(). This stinks, but it's better than letting > - * things continue without having a proper hard readonly > - * here. */ > - OCFS2_SB(sb)->s_mount_opt |= OCFS2_MOUNT_ERRORS_PANIC; > + /* Force a panic() for clustered mounts. This stinks, but it's > + * better than letting things continue withouthaving a proper > + * hard readonly here. > + * */ > + if (!ocfs2_mount_local(OCFS2_SB(sb))) > + OCFS2_SB(sb)->s_mount_opt |= OCFS2_MOUNT_ERRORS_PANIC; > ocfs2_handle_error(sb); > } > > From sunil.mushran at oracle.com Mon Nov 23 13:31:40 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Mon, 23 Nov 2009 13:31:40 -0800 Subject: [Ocfs2-devel] [PATCH 1/2] ocfs2: Enable fiemap() support In-Reply-To: <1259011901-13582-1-git-send-email-sunil.mushran@oracle.com> References: <1259011901-13582-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1259011901-13582-2-git-send-email-sunil.mushran@oracle.com> EL5 U4 enables fiemap() support for file systems that has FS_HAS_FIEMAP flag set. Patch detects such kernels and appends the flag to enable it. Signed-off-by: Sunil Mushran --- Config.make.in | 1 + configure.in | 5 +++++ fs/ocfs2/Makefile | 4 ++++ fs/ocfs2/super.c | 4 ++++ 4 files changed, 14 insertions(+), 0 deletions(-) diff --git a/Config.make.in b/Config.make.in index acbe8fd..c149524 100644 --- a/Config.make.in +++ b/Config.make.in @@ -84,6 +84,7 @@ NO_NAME_IN_BACKING_DEV_INFO=@NO_NAME_IN_BACKING_DEV_INFO@ NO_KOBJ_ATTRIBUTE = @NO_KOBJ_ATTRIBUTE@ SKIP_QUOTAS= @SKIP_QUOTAS@ SKIP_EXPORTS= @SKIP_EXPORTS@ +APPEND_FIEMAP_FLAG=@APPEND_FIEMAP_FLAG@ OCFS_DEBUG = @OCFS_DEBUG@ diff --git a/configure.in b/configure.in index 405e1a5..fc46d2c 100644 --- a/configure.in +++ b/configure.in @@ -459,6 +459,11 @@ OCFS2_CHECK_KERNEL([cancel_work_sync() in workqueue.h], workqueue.h, , cancel_work_sync_header=cancel_work_sync.h, [extern int cancel_work_sync(struct work_struct]) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $cancel_work_sync_header" +APPEND_FIEMAP_FLAG= +OCFS2_CHECK_KERNEL([ FS_HAS_FIEMAP in fs.h], fs.h, + APPEND_FIEMAP_FLAG=yes, , [#define FS_HAS_FIEMAP ]) +AC_SUBST(APPEND_FIEMAP_FLAG) + # End kapi_compat checks # using -include has two advantages: diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile index 848c121..1905000 100644 --- a/fs/ocfs2/Makefile +++ b/fs/ocfs2/Makefile @@ -136,6 +136,10 @@ ifdef SKIP_EXPORTS EXTRA_CFLAGS += -DSKIP_EXPORTS endif +ifdef APPEND_FIEMAP_FLAG +EXTRA_CFLAGS += -DAPPEND_FIEMAP_FLAG +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes. diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index f6e2c69..adc337f 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c @@ -1559,6 +1559,10 @@ static int __init ocfs2_init(void) ocfs2_print_version(); +#ifdef APPEND_FIEMAP_FLAG + ocfs2_fs_type.fs_flags |= FS_HAS_FIEMAP; +#endif + status = init_ocfs2_uptodate_cache(); if (status < 0) { mlog_errno(status); -- 1.6.3.3 From sunil.mushran at oracle.com Mon Nov 23 13:31:39 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Mon, 23 Nov 2009 13:31:39 -0800 Subject: [Ocfs2-devel] ocfs2 1.6 - seventh set Message-ID: <1259011901-13582-1-git-send-email-sunil.mushran@oracle.com> Two simple straight-forward non-controversial patches.... I hope. From sunil.mushran at oracle.com Mon Nov 23 13:31:41 2009 From: sunil.mushran at oracle.com (Sunil Mushran) Date: Mon, 23 Nov 2009 13:31:41 -0800 Subject: [Ocfs2-devel] [PATCH 2/2] ocfs2: Enable fallocate() support In-Reply-To: <1259011901-13582-1-git-send-email-sunil.mushran@oracle.com> References: <1259011901-13582-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <1259011901-13582-3-git-send-email-sunil.mushran@oracle.com> EL5 U4 enables fallocate() support for file systems that has FS_HAS_FALLOCATE flag set. Patch detects such kernels and appends the flag to enable it. Signed-off-by: Sunil Mushran --- Config.make.in | 1 + configure.in | 5 +++++ fs/ocfs2/Makefile | 4 ++++ fs/ocfs2/super.c | 4 ++++ 4 files changed, 14 insertions(+), 0 deletions(-) diff --git a/Config.make.in b/Config.make.in index c149524..c12ee75 100644 --- a/Config.make.in +++ b/Config.make.in @@ -85,6 +85,7 @@ NO_KOBJ_ATTRIBUTE = @NO_KOBJ_ATTRIBUTE@ SKIP_QUOTAS= @SKIP_QUOTAS@ SKIP_EXPORTS= @SKIP_EXPORTS@ APPEND_FIEMAP_FLAG=@APPEND_FIEMAP_FLAG@ +APPEND_FALLOCATE_FLAG=@APPEND_FALLOCATE_FLAG@ OCFS_DEBUG = @OCFS_DEBUG@ diff --git a/configure.in b/configure.in index fc46d2c..af7b575 100644 --- a/configure.in +++ b/configure.in @@ -464,6 +464,11 @@ OCFS2_CHECK_KERNEL([ FS_HAS_FIEMAP in fs.h], fs.h, APPEND_FIEMAP_FLAG=yes, , [#define FS_HAS_FIEMAP ]) AC_SUBST(APPEND_FIEMAP_FLAG) +APPEND_FALLOCATE_FLAG= +OCFS2_CHECK_KERNEL([ FS_HAS_FALLOCATE in fs.h], fs.h, + APPEND_FALLOCATE_FLAG=yes, , [#define FS_HAS_FALLOCATE ]) +AC_SUBST(APPEND_FALLOCATE_FLAG) + # End kapi_compat checks # using -include has two advantages: diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile index 1905000..1cc1aaf 100644 --- a/fs/ocfs2/Makefile +++ b/fs/ocfs2/Makefile @@ -140,6 +140,10 @@ ifdef APPEND_FIEMAP_FLAG EXTRA_CFLAGS += -DAPPEND_FIEMAP_FLAG endif +ifdef APPEND_FALLOCATE_FLAG +EXTRA_CFLAGS += -DAPPEND_FALLOCATE_FLAG +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes. diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index adc337f..fe79509 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c @@ -1563,6 +1563,10 @@ static int __init ocfs2_init(void) ocfs2_fs_type.fs_flags |= FS_HAS_FIEMAP; #endif +#ifdef APPEND_FALLOCATE_FLAG + ocfs2_fs_type.fs_flags |= FS_HAS_FALLOCATE; +#endif + status = init_ocfs2_uptodate_cache(); if (status < 0) { mlog_errno(status); -- 1.6.3.3 From Joel.Becker at oracle.com Mon Nov 23 16:45:25 2009 From: Joel.Becker at oracle.com (Joel Becker) Date: Mon, 23 Nov 2009 16:45:25 -0800 Subject: [Ocfs2-devel] ocfs2 1.6 - seventh set In-Reply-To: <1259011901-13582-1-git-send-email-sunil.mushran@oracle.com> References: <1259011901-13582-1-git-send-email-sunil.mushran@oracle.com> Message-ID: <20091124004524.GA10079@mail.oracle.com> On Mon, Nov 23, 2009 at 01:31:39PM -0800, Sunil Mushran wrote: > Two simple straight-forward non-controversial patches.... I hope. I'm guessing these FS_HAS_* flags only exist in EL5U4. This works just fine. Joel -- "Nearly all men can stand adversity, but if you really want to test a man's character, give him power." - Abraham Lincoln Joel Becker Principal Software Developer Oracle E-mail: joel.becker at oracle.com Phone: (650) 506-8127