[PATCH] [Coding Style]: fs/ext{3,4}/balloc.c
Signed-off-by: Mathieu Segaud <[EMAIL PROTECTED]> --- fs/ext3/balloc.c | 101 -- fs/ext4/balloc.c | 93 + 2 files changed, 100 insertions(+), 94 deletions(-) diff --git a/fs/ext3/balloc.c b/fs/ext3/balloc.c index a8ba7e8..feb00fb 100644 --- a/fs/ext3/balloc.c +++ b/fs/ext3/balloc.c @@ -45,17 +45,17 @@ * @bh:pointer to the buffer head to store the block * group descriptor */ -struct ext3_group_desc * ext3_get_group_desc(struct super_block * sb, +struct ext3_group_desc *ext3_get_group_desc(struct super_block *sb, unsigned int block_group, -struct buffer_head ** bh) +struct buffer_head **bh) { unsigned long group_desc; unsigned long offset; - struct ext3_group_desc * desc; + struct ext3_group_desc *desc; struct ext3_sb_info *sbi = EXT3_SB(sb); if (block_group >= sbi->s_groups_count) { - ext3_error (sb, "ext3_get_group_desc", + ext3_error(sb, "ext3_get_group_desc", "block_group >= groups_count - " "block_group = %d, groups_count = %lu", block_group, sbi->s_groups_count); @@ -67,7 +67,7 @@ struct ext3_group_desc * ext3_get_group_desc(struct super_block * sb, group_desc = block_group >> EXT3_DESC_PER_BLOCK_BITS(sb); offset = block_group & (EXT3_DESC_PER_BLOCK(sb) - 1); if (!sbi->s_group_desc[group_desc]) { - ext3_error (sb, "ext3_get_group_desc", + ext3_error(sb, "ext3_get_group_desc", "Group descriptor not loaded - " "block_group = %d, group_desc = %lu, desc = %lu", block_group, group_desc, offset); @@ -93,15 +93,15 @@ struct ext3_group_desc * ext3_get_group_desc(struct super_block * sb, static struct buffer_head * read_block_bitmap(struct super_block *sb, unsigned int block_group) { - struct ext3_group_desc * desc; - struct buffer_head * bh = NULL; + struct ext3_group_desc *desc; + struct buffer_head *bh = NULL; - desc = ext3_get_group_desc (sb, block_group, NULL); + desc = ext3_get_group_desc(sb, block_group, NULL); if (!desc) goto error_out; bh = sb_bread(sb, le32_to_cpu(desc->bg_block_bitmap)); if (!bh) - ext3_error (sb, "read_block_bitmap", + ext3_error(sb, "read_block_bitmap", "Cannot read block bitmap - " "block_group = %d, block_bitmap = %u", block_group, le32_to_cpu(desc->bg_block_bitmap)); @@ -142,26 +142,26 @@ restart: bad = 0; prev = NULL; - printk("Block Allocation Reservation Windows Map (%s):\n", fn); + printk(KERN_INFO "Block Allocation Reservation Windows Map (%s):\n", fn); while (n) { rsv = rb_entry(n, struct ext3_reserve_window_node, rsv_node); if (verbose) - printk("reservation window 0x%p " + printk(KERN_INFO "reservation window 0x%p " "start: %lu, end: %lu\n", rsv, rsv->rsv_start, rsv->rsv_end); if (rsv->rsv_start && rsv->rsv_start >= rsv->rsv_end) { - printk("Bad reservation %p (start >= end)\n", - rsv); + printk(KERN_WARNING "Bad reservation %p (start >= end)\n", rsv); bad = 1; } if (prev && prev->rsv_end >= rsv->rsv_start) { - printk("Bad reservation %p (prev->end >= start)\n", - rsv); + printk(KERN_WARNING + "Bad reservation %p (prev->end >= start)\n", rsv); bad = 1; } if (bad) { if (!verbose) { - printk("Restarting reservation walk in verbose mode\n"); + printk(KERN_WARNING + "Restarting reservation walk in verbose mode\n"); verbose = 1; goto restart; } @@ -169,7 +169,7 @@ restart:
[PATCH] [Coding Style]: fs/ext{3,4}/ext{3,4}_jbd{,2}.c
Misc style fixes from checkpatch.pl Signed-off-by: Mathieu Segaud <[EMAIL PROTECTED]> --- fs/ext3/ext3_jbd.c | 12 ++-- fs/ext4/ext4_jbd2.c | 12 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/fs/ext3/ext3_jbd.c b/fs/ext3/ext3_jbd.c index e1f91fd..6c96260 100644 --- a/fs/ext3/ext3_jbd.c +++ b/fs/ext3/ext3_jbd.c @@ -9,7 +9,7 @@ int __ext3_journal_get_undo_access(const char *where, handle_t *handle, { int err = journal_get_undo_access(handle, bh); if (err) - ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err); + ext3_journal_abort_handle(where, __FUNCTION__, bh, handle, err); return err; } @@ -18,7 +18,7 @@ int __ext3_journal_get_write_access(const char *where, handle_t *handle, { int err = journal_get_write_access(handle, bh); if (err) - ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err); + ext3_journal_abort_handle(where, __FUNCTION__, bh, handle, err); return err; } @@ -27,7 +27,7 @@ int __ext3_journal_forget(const char *where, handle_t *handle, { int err = journal_forget(handle, bh); if (err) - ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err); + ext3_journal_abort_handle(where, __FUNCTION__, bh, handle, err); return err; } @@ -36,7 +36,7 @@ int __ext3_journal_revoke(const char *where, handle_t *handle, { int err = journal_revoke(handle, blocknr, bh); if (err) - ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err); + ext3_journal_abort_handle(where, __FUNCTION__, bh, handle, err); return err; } @@ -45,7 +45,7 @@ int __ext3_journal_get_create_access(const char *where, { int err = journal_get_create_access(handle, bh); if (err) - ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err); + ext3_journal_abort_handle(where, __FUNCTION__, bh, handle, err); return err; } @@ -54,6 +54,6 @@ int __ext3_journal_dirty_metadata(const char *where, { int err = journal_dirty_metadata(handle, bh); if (err) - ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err); + ext3_journal_abort_handle(where, __FUNCTION__, bh, handle, err); return err; } diff --git a/fs/ext4/ext4_jbd2.c b/fs/ext4/ext4_jbd2.c index d6afe4e..2256c43 100644 --- a/fs/ext4/ext4_jbd2.c +++ b/fs/ext4/ext4_jbd2.c @@ -9,7 +9,7 @@ int __ext4_journal_get_undo_access(const char *where, handle_t *handle, { int err = jbd2_journal_get_undo_access(handle, bh); if (err) - ext4_journal_abort_handle(where, __FUNCTION__, bh, handle,err); + ext4_journal_abort_handle(where, __FUNCTION__, bh, handle, err); return err; } @@ -18,7 +18,7 @@ int __ext4_journal_get_write_access(const char *where, handle_t *handle, { int err = jbd2_journal_get_write_access(handle, bh); if (err) - ext4_journal_abort_handle(where, __FUNCTION__, bh, handle,err); + ext4_journal_abort_handle(where, __FUNCTION__, bh, handle, err); return err; } @@ -27,7 +27,7 @@ int __ext4_journal_forget(const char *where, handle_t *handle, { int err = jbd2_journal_forget(handle, bh); if (err) - ext4_journal_abort_handle(where, __FUNCTION__, bh, handle,err); + ext4_journal_abort_handle(where, __FUNCTION__, bh, handle, err); return err; } @@ -36,7 +36,7 @@ int __ext4_journal_revoke(const char *where, handle_t *handle, { int err = jbd2_journal_revoke(handle, blocknr, bh); if (err) - ext4_journal_abort_handle(where, __FUNCTION__, bh, handle,err); + ext4_journal_abort_handle(where, __FUNCTION__, bh, handle, err); return err; } @@ -45,7 +45,7 @@ int __ext4_journal_get_create_access(const char *where, { int err = jbd2_journal_get_create_access(handle, bh); if (err) - ext4_journal_abort_handle(where, __FUNCTION__, bh, handle,err); + ext4_journal_abort_handle(where, __FUNCTION__, bh, handle, err); return err; } @@ -54,6 +54,6 @@ int __ext4_journal_dirty_metadata(const char *where, { int err = jbd2_journal_dirty_metadata(handle, bh); if (err) - ext4_journal_abort_handle(where, __FUNCTION__, bh, handle,err); + ext4_journal_abort_handle(where, __FUNCTION__, bh, handle, err); return err; } -- 1.5.3.7 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] [Coding Style]: fs/ext{3,4}/bitmap.c
Signed-off-by: Mathieu Segaud <[EMAIL PROTECTED]> --- fs/ext3/bitmap.c |2 +- fs/ext4/bitmap.c |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ext3/bitmap.c b/fs/ext3/bitmap.c index 6afc39d..c402bc4 100644 --- a/fs/ext3/bitmap.c +++ b/fs/ext3/bitmap.c @@ -15,7 +15,7 @@ static const int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0}; -unsigned long ext3_count_free (struct buffer_head * map, unsigned int numchars) +unsigned long ext3_count_free(struct buffer_head *map, unsigned int numchars) { unsigned int i; unsigned long sum = 0; diff --git a/fs/ext4/bitmap.c b/fs/ext4/bitmap.c index 420554f..a473206 100644 --- a/fs/ext4/bitmap.c +++ b/fs/ext4/bitmap.c @@ -15,7 +15,7 @@ static const int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0}; -unsigned long ext4_count_free (struct buffer_head * map, unsigned int numchars) +unsigned long ext4_count_free(struct buffer_head *map, unsigned int numchars) { unsigned int i; unsigned long sum = 0; -- 1.5.3.7 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] [Coding Style]: fs/ext{3,4}/dir.c
Misc style fixes from checkpatch.pl Signed-off-by: Mathieu Segaud <[EMAIL PROTECTED]> --- fs/ext3/dir.c | 55 --- fs/ext4/dir.c | 50 +- 2 files changed, 53 insertions(+), 52 deletions(-) diff --git a/fs/ext3/dir.c b/fs/ext3/dir.c index 8ca3bfd..fc3621e 100644 --- a/fs/ext3/dir.c +++ b/fs/ext3/dir.c @@ -33,10 +33,10 @@ static unsigned char ext3_filetype_table[] = { }; static int ext3_readdir(struct file *, void *, filldir_t); -static int ext3_dx_readdir(struct file * filp, - void * dirent, filldir_t filldir); -static int ext3_release_dir (struct inode * inode, - struct file * filp); +static int ext3_dx_readdir(struct file *filp, + void *dirent, filldir_t filldir); +static int ext3_release_dir(struct inode *inode, + struct file *filp); const struct file_operations ext3_dir_operations = { .llseek = generic_file_llseek, @@ -61,12 +61,12 @@ static unsigned char get_dtype(struct super_block *sb, int filetype) } -int ext3_check_dir_entry (const char * function, struct inode * dir, - struct ext3_dir_entry_2 * de, - struct buffer_head * bh, +int ext3_check_dir_entry(const char *function, struct inode *dir, + struct ext3_dir_entry_2 *de, + struct buffer_head *bh, unsigned long offset) { - const char * error_msg = NULL; + const char *error_msg = NULL; const int rlen = ext3_rec_len_from_disk(de->rec_len); if (rlen < EXT3_DIR_REC_LEN(1)) @@ -82,7 +82,7 @@ int ext3_check_dir_entry (const char * function, struct inode * dir, error_msg = "inode out of bounds"; if (error_msg != NULL) - ext3_error (dir->i_sb, function, + ext3_error(dir->i_sb, function, "bad entry in directory #%lu: %s - " "offset=%lu, inode=%lu, rec_len=%d, name_len=%d", dir->i_ino, error_msg, offset, @@ -91,8 +91,8 @@ int ext3_check_dir_entry (const char * function, struct inode * dir, return error_msg == NULL ? 1 : 0; } -static int ext3_readdir(struct file * filp, -void * dirent, filldir_t filldir) +static int ext3_readdir(struct file *filp, +void *dirent, filldir_t filldir) { int error = 0; unsigned long offset; @@ -148,7 +148,7 @@ static int ext3_readdir(struct file * filp, * of recovering data when there's a bad sector */ if (!bh) { - ext3_error (sb, "ext3_readdir", + ext3_error(sb, "ext3_readdir", "directory #%lu contains a hole at offset %lu", inode->i_ino, (unsigned long)filp->f_pos); /* corrupt size? Maybe no more blocks to read */ @@ -187,13 +187,14 @@ revalidate: while (!error && filp->f_pos < inode->i_size && offset < sb->s_blocksize) { de = (struct ext3_dir_entry_2 *) (bh->b_data + offset); - if (!ext3_check_dir_entry ("ext3_readdir", inode, de, + if (!ext3_check_dir_entry("ext3_readdir", inode, de, bh, offset)) { - /* On error, skip the f_pos to the - next block. */ + /* +* On error, skip the f_pos to the next block. +*/ filp->f_pos = (filp->f_pos | (sb->s_blocksize - 1)) + 1; - brelse (bh); + brelse(bh); ret = stored; goto out; } @@ -217,12 +218,12 @@ revalidate: break; if (version != filp->f_version) goto revalidate; - stored ++; + stored++; } filp->f_pos += ext3_rec_len_from_disk(de->rec_len); } offset = 0; - brelse (bh); + brelse(bh); } out: return ret; @@ -289,9 +290,9 @@ static void free_rb_tree_fname(struct rb_root *root) parent = rb_parent(n);
[PATCH] [Coding Style]: misc fixes for fs/ext{3,4}/acl.{c,h} from checkpatch.pl
Signed-off-by: Mathieu Segaud <[EMAIL PROTECTED]> --- fs/ext3/acl.c | 194 fs/ext3/acl.h |6 +- fs/ext4/acl.c | 190 fs/ext4/acl.h |6 +- 4 files changed, 198 insertions(+), 198 deletions(-) diff --git a/fs/ext3/acl.c b/fs/ext3/acl.c index d34e996..8de0050 100644 --- a/fs/ext3/acl.c +++ b/fs/ext3/acl.c @@ -40,34 +40,34 @@ ext3_acl_from_disk(const void *value, size_t size) acl = posix_acl_alloc(count, GFP_KERNEL); if (!acl) return ERR_PTR(-ENOMEM); - for (n=0; n < count; n++) { + for (n = 0; n < count; n++) { ext3_acl_entry *entry = (ext3_acl_entry *)value; if ((char *)value + sizeof(ext3_acl_entry_short) > end) goto fail; acl->a_entries[n].e_tag = le16_to_cpu(entry->e_tag); acl->a_entries[n].e_perm = le16_to_cpu(entry->e_perm); - switch(acl->a_entries[n].e_tag) { - case ACL_USER_OBJ: - case ACL_GROUP_OBJ: - case ACL_MASK: - case ACL_OTHER: - value = (char *)value + - sizeof(ext3_acl_entry_short); - acl->a_entries[n].e_id = ACL_UNDEFINED_ID; - break; - - case ACL_USER: - case ACL_GROUP: - value = (char *)value + sizeof(ext3_acl_entry); - if ((char *)value > end) - goto fail; - acl->a_entries[n].e_id = - le32_to_cpu(entry->e_id); - break; - - default: + switch (acl->a_entries[n].e_tag) { + case ACL_USER_OBJ: + case ACL_GROUP_OBJ: + case ACL_MASK: + case ACL_OTHER: + value = (char *)value + + sizeof(ext3_acl_entry_short); + acl->a_entries[n].e_id = ACL_UNDEFINED_ID; + break; + + case ACL_USER: + case ACL_GROUP: + value = (char *)value + sizeof(ext3_acl_entry); + if ((char *)value > end) goto fail; + acl->a_entries[n].e_id = + le32_to_cpu(entry->e_id); + break; + + default: + goto fail; } } if (value != end) @@ -96,27 +96,27 @@ ext3_acl_to_disk(const struct posix_acl *acl, size_t *size) return ERR_PTR(-ENOMEM); ext_acl->a_version = cpu_to_le32(EXT3_ACL_VERSION); e = (char *)ext_acl + sizeof(ext3_acl_header); - for (n=0; n < acl->a_count; n++) { + for (n = 0; n < acl->a_count; n++) { ext3_acl_entry *entry = (ext3_acl_entry *)e; entry->e_tag = cpu_to_le16(acl->a_entries[n].e_tag); entry->e_perm = cpu_to_le16(acl->a_entries[n].e_perm); - switch(acl->a_entries[n].e_tag) { - case ACL_USER: - case ACL_GROUP: - entry->e_id = - cpu_to_le32(acl->a_entries[n].e_id); - e += sizeof(ext3_acl_entry); - break; - - case ACL_USER_OBJ: - case ACL_GROUP_OBJ: - case ACL_MASK: - case ACL_OTHER: - e += sizeof(ext3_acl_entry_short); - break; - - default: - goto fail; + switch (acl->a_entries[n].e_tag) { + case ACL_USER: + case ACL_GROUP: + entry->e_id = + cpu_to_le32(acl->a_entries[n].e_id); + e += sizeof(ext3_acl_entry); + break; + + case ACL_USER_OBJ: + case ACL_GROUP_OBJ: + case ACL_MASK: + case ACL_OTHER: + e += sizeof(ext3_acl_entry_short); + break; + + default: + goto fail; } } return (char *)ext_acl; @@ -141,7 +141,7 @@ ext3_iget_acl(struct inode *inode, struct posix_acl **i_acl) static inline void ext3_iset_acl(struct inode *inode, struct posix_acl **i_acl, - str
Re: [PATCH] [Coding Style]: fs/ext{3,4}/ext{3,4}_jbd{,2}.c
Vous m'avez dit récemment : [snip] > Hi Mathieu > > What about changing the __FUNCTION__ to __func__, while you are at it? well, won't do any harm, even though other compilers than GCC are not officialy supported :) thanks a lot And I think I will revamp, including fixes into fs/ext2 -- Mathieu -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] [Coding Style]: misc fixes for fs/ext{3,4}/acl.{c,h} from checkpatch.pl
Vous m'avez dit récemment : > Coding-style only changes tends to screw up our ability to merge > pending patches, but I'll take care of it, thanks yep, I noticed that... would you rather me wait till 2.6.24 is out ? -- Mathieu -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: The ext3 way of journalling
Vous m'avez dit récemment : > On 2008-01-08, John Stoffel <[EMAIL PROTECTED]> wrote: >> Look at your filesystems, using 'tune2fs' and see if the ext3 journal >> is actually turned on and used. If it's not, then I can see why >> you're having problems on reboots. > > Journalling is on, but it's no use because the superblock always has > corrupted last-checked time at boot. "File system check forced: 31352 > days since last check" or so. fix your hardware clock then -- Mathieu -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[RESENT] Fix previously extX_ioctl() patches
This two patches discards and replaces 2 previously sent patches they convert ext3/4_ioctl()s to unlocked_ioctl's -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] Convert ext4_ioctl to an unlocked_ioctl
Signed-off-by: Mathieu Segaud <[EMAIL PROTECTED]> --- fs/ext4/dir.c |2 +- fs/ext4/file.c |2 +- fs/ext4/ioctl.c | 161 --- include/linux/ext4_fs.h |3 +- 4 files changed, 112 insertions(+), 56 deletions(-) diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c index f612bef..8f6677a 100644 --- a/fs/ext4/dir.c +++ b/fs/ext4/dir.c @@ -42,7 +42,7 @@ const struct file_operations ext4_dir_operations = { .llseek = generic_file_llseek, .read = generic_read_dir, .readdir= ext4_readdir, /* we take BKL. needed?*/ - .ioctl = ext4_ioctl, /* BKL held */ + .unlocked_ioctl = ext4_ioctl, /* BKL held */ #ifdef CONFIG_COMPAT .compat_ioctl = ext4_compat_ioctl, #endif diff --git a/fs/ext4/file.c b/fs/ext4/file.c index 1a81cd6..34852a9 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c @@ -112,7 +112,7 @@ const struct file_operations ext4_file_operations = { .write = do_sync_write, .aio_read = generic_file_aio_read, .aio_write = ext4_file_write, - .ioctl = ext4_ioctl, + .unlocked_ioctl = ext4_ioctl, #ifdef CONFIG_COMPAT .compat_ioctl = ext4_compat_ioctl, #endif diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index e7f894b..d5951d3 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c @@ -17,12 +17,18 @@ #include #include -int ext4_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, - unsigned long arg) +long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { - struct ext4_inode_info *ei = EXT4_I(inode); + struct ext4_inode_info *ei; + struct inode *inode; unsigned int flags; unsigned short rsv_window_size; + long retval = 0; + + lock_kernel(); + + inode = filp->f_path.dentry->d_inode; + ei = EXT4_I(inode); ext4_debug ("cmd = %u, arg = %lu\n", cmd, arg); @@ -30,7 +36,8 @@ int ext4_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, case EXT4_IOC_GETFLAGS: ext4_get_inode_flags(ei); flags = ei->i_flags & EXT4_FL_USER_VISIBLE; - return put_user(flags, (int __user *) arg); + retval = put_user(flags, (int __user *) arg); + goto out; case EXT4_IOC_SETFLAGS: { handle_t *handle = NULL; int err; @@ -38,14 +45,20 @@ int ext4_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, unsigned int oldflags; unsigned int jflag; - if (IS_RDONLY(inode)) - return -EROFS; + if (IS_RDONLY(inode)) { + retval = -EROFS; + goto out; + } - if (!is_owner_or_cap(inode)) - return -EACCES; + if (!is_owner_or_cap(inode)) { + retval = -EACCES; + goto out; + } - if (get_user(flags, (int __user *) arg)) - return -EFAULT; + if (get_user(flags, (int __user *) arg)) { + retval = -EFAULT; + goto out; + } if (!S_ISDIR(inode->i_mode)) flags &= ~EXT4_DIRSYNC_FL; @@ -54,7 +67,8 @@ int ext4_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, /* Is it quota file? Do not allow user to mess with it */ if (IS_NOQUOTA(inode)) { mutex_unlock(&inode->i_mutex); - return -EPERM; + retval = -EPERM; + goto out; } oldflags = ei->i_flags; @@ -70,7 +84,8 @@ int ext4_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, if ((flags ^ oldflags) & (EXT4_APPEND_FL | EXT4_IMMUTABLE_FL)) { if (!capable(CAP_LINUX_IMMUTABLE)) { mutex_unlock(&inode->i_mutex); - return -EPERM; + retval = -EPERM; + goto out; } } @@ -81,7 +96,8 @@ int ext4_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, if ((jflag ^ oldflags) & (EXT4_JOURNAL_DATA_FL)) { if (!capable(CAP_SYS_RESOURCE)) { mutex_unlock(&inode->i_mutex); - return -EPERM; + retval = -EPERM; + goto out; } } @@ -89,7 +105,8 @@ int ext4_ioctl (struct inode *
[PATCH] Convert ext3_ioctl() to an unlocked_ioctl
Signed-off-by: Mathieu Segaud <[EMAIL PROTECTED]> --- fs/ext3/dir.c |2 +- fs/ext3/file.c |2 +- fs/ext3/ioctl.c | 161 --- include/linux/ext3_fs.h |3 +- 4 files changed, 113 insertions(+), 55 deletions(-) diff --git a/fs/ext3/dir.c b/fs/ext3/dir.c index 8ca3bfd..5ab6b88 100644 --- a/fs/ext3/dir.c +++ b/fs/ext3/dir.c @@ -42,7 +42,7 @@ const struct file_operations ext3_dir_operations = { .llseek = generic_file_llseek, .read = generic_read_dir, .readdir= ext3_readdir, /* we take BKL. needed?*/ - .ioctl = ext3_ioctl, /* BKL held */ + .unlocked_ioctl = ext3_ioctl, /* BKL held */ #ifdef CONFIG_COMPAT .compat_ioctl = ext3_compat_ioctl, #endif diff --git a/fs/ext3/file.c b/fs/ext3/file.c index acc4913..49798ed 100644 --- a/fs/ext3/file.c +++ b/fs/ext3/file.c @@ -112,7 +112,7 @@ const struct file_operations ext3_file_operations = { .write = do_sync_write, .aio_read = generic_file_aio_read, .aio_write = ext3_file_write, - .ioctl = ext3_ioctl, + .unlocked_ioctl = ext3_ioctl, #ifdef CONFIG_COMPAT .compat_ioctl = ext3_compat_ioctl, #endif diff --git a/fs/ext3/ioctl.c b/fs/ext3/ioctl.c index 023a070..a7c480a 100644 --- a/fs/ext3/ioctl.c +++ b/fs/ext3/ioctl.c @@ -17,12 +17,19 @@ #include #include -int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, +long ext3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { - struct ext3_inode_info *ei = EXT3_I(inode); + struct ext3_inode_info *ei; + struct inode *inode; unsigned int flags; unsigned short rsv_window_size; + long retval = 0; + + lock_kernel(); + + inode = filp->f_path.dentry->d_inode; + ei = EXT3_I(inode); ext3_debug ("cmd = %u, arg = %lu\n", cmd, arg); @@ -30,7 +37,8 @@ int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, case EXT3_IOC_GETFLAGS: ext3_get_inode_flags(ei); flags = ei->i_flags & EXT3_FL_USER_VISIBLE; - return put_user(flags, (int __user *) arg); + retval = put_user(flags, (int __user *) arg); + goto out; case EXT3_IOC_SETFLAGS: { handle_t *handle = NULL; int err; @@ -38,14 +46,20 @@ int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, unsigned int oldflags; unsigned int jflag; - if (IS_RDONLY(inode)) - return -EROFS; + if (IS_RDONLY(inode)) { + retval = -EROFS; + goto out; + } - if (!is_owner_or_cap(inode)) - return -EACCES; + if (!is_owner_or_cap(inode)) { + retval = -EACCES; + goto out; + } - if (get_user(flags, (int __user *) arg)) - return -EFAULT; + if (get_user(flags, (int __user *) arg)) { + retval = -EFAULT; + goto out; + } if (!S_ISDIR(inode->i_mode)) flags &= ~EXT3_DIRSYNC_FL; @@ -54,7 +68,8 @@ int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, /* Is it quota file? Do not allow user to mess with it */ if (IS_NOQUOTA(inode)) { mutex_unlock(&inode->i_mutex); - return -EPERM; + retval = -EPERM; + goto out; } oldflags = ei->i_flags; @@ -70,7 +85,8 @@ int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, if ((flags ^ oldflags) & (EXT3_APPEND_FL | EXT3_IMMUTABLE_FL)) { if (!capable(CAP_LINUX_IMMUTABLE)) { mutex_unlock(&inode->i_mutex); - return -EPERM; + retval = -EPERM; + goto out; } } @@ -81,7 +97,8 @@ int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, if ((jflag ^ oldflags) & (EXT3_JOURNAL_DATA_FL)) { if (!capable(CAP_SYS_RESOURCE)) { mutex_unlock(&inode->i_mutex); - return -EPERM; + retval = -EPERM; + goto out; } } @@ -89,7 +106,8 @@ int ext3_ioctl (struct inode * inode, struct file * filp,
[PATCH] Convert drivers/scsi/ch.c to use unlocked_ioctl
As of now, compat_ioctl already runs without the BKL, whereas ioctl runs with the BKL. This patch first converts changer_fops to use a .unlocked_ioctl member. It applies the same locking rationale than ch_ioctl_compat() uses to ch_ioctl(). Signed-off-by: Mathieu Segaud <[EMAIL PROTECTED]> --- drivers/scsi/ch.c | 19 +-- 1 files changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c index 2311019..b8e005d 100644 --- a/drivers/scsi/ch.c +++ b/drivers/scsi/ch.c @@ -21,6 +21,7 @@ #include #include /* here are all the ioctls */ #include +#include #include #include @@ -92,8 +93,7 @@ static int ch_probe(struct device *); static int ch_remove(struct device *); static int ch_open(struct inode * inode, struct file * filp); static int ch_release(struct inode * inode, struct file * filp); -static int ch_ioctl(struct inode * inode, struct file * filp, -unsigned int cmd, unsigned long arg); +static long ch_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); #ifdef CONFIG_COMPAT static long ch_ioctl_compat(struct file * filp, unsigned int cmd, unsigned long arg); @@ -130,12 +130,12 @@ static struct scsi_driver ch_template = static const struct file_operations changer_fops = { - .owner= THIS_MODULE, - .open = ch_open, - .release = ch_release, - .ioctl= ch_ioctl, + .owner = THIS_MODULE, + .open = ch_open, + .release= ch_release, + .unlocked_ioctl = ch_ioctl, #ifdef CONFIG_COMPAT - .compat_ioctl = ch_ioctl_compat, + .compat_ioctl = ch_ioctl_compat, #endif }; @@ -626,7 +626,7 @@ ch_checkrange(scsi_changer *ch, unsigned int type, unsigned int unit) return 0; } -static int ch_ioctl(struct inode * inode, struct file * file, +static long ch_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { scsi_changer *ch = file->private_data; @@ -887,8 +887,7 @@ static long ch_ioctl_compat(struct file * file, case CHIOINITELEM: case CHIOSVOLTAG: /* compatible */ - return ch_ioctl(NULL /* inode, unused */, - file, cmd, arg); + return ch_ioctl(file, cmd, arg); case CHIOGSTATUS32: { struct changer_element_status32 ces32; -- 1.5.3.8 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Convert drivers/scsi/ch.c to use unlocked_ioctl
Vous m'avez dit récemment : > On Mon, Jan 14, 2008 at 02:32:13PM +0100, Mathieu Segaud wrote: >> +#include > You don't add any uses of lock_kernel() and there are none in the > driver currently. yep, it was before I noticed the locking semantics of ch_ioctl_compat() >> -.owner= THIS_MODULE, >> -.open = ch_open, >> -.release = ch_release, >> -.ioctl= ch_ioctl, >> +.owner = THIS_MODULE, >> +.open = ch_open, >> +.release= ch_release, >> +.unlocked_ioctl = ch_ioctl, > > If you're going to do the gratuitous reformatting, at least use tabs > instead of spaces. thanks, will do > Other than that, should be fine. I repost this one thanks a lot. -- Mathieu -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] Convert drivers/scsi/ch.c to use unlocked_ioctl
As of now, compat_ioctl already runs without the BKL, whereas ioctl runs with the BKL. This patch first converts changer_fops to use a .unlocked_ioctl member. It applies the same locking rationale than ch_ioctl_compat() uses to ch_ioctl(). Signed-off-by: Mathieu Segaud <[EMAIL PROTECTED]> --- drivers/scsi/ch.c | 18 -- 1 files changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c index 2311019..389777c 100644 --- a/drivers/scsi/ch.c +++ b/drivers/scsi/ch.c @@ -92,8 +92,7 @@ static int ch_probe(struct device *); static int ch_remove(struct device *); static int ch_open(struct inode * inode, struct file * filp); static int ch_release(struct inode * inode, struct file * filp); -static int ch_ioctl(struct inode * inode, struct file * filp, -unsigned int cmd, unsigned long arg); +static long ch_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); #ifdef CONFIG_COMPAT static long ch_ioctl_compat(struct file * filp, unsigned int cmd, unsigned long arg); @@ -130,12 +129,12 @@ static struct scsi_driver ch_template = static const struct file_operations changer_fops = { - .owner= THIS_MODULE, - .open = ch_open, - .release = ch_release, - .ioctl= ch_ioctl, + .owner = THIS_MODULE, + .open = ch_open, + .release= ch_release, + .unlocked_ioctl = ch_ioctl, #ifdef CONFIG_COMPAT - .compat_ioctl = ch_ioctl_compat, + .compat_ioctl = ch_ioctl_compat, #endif }; @@ -626,7 +625,7 @@ ch_checkrange(scsi_changer *ch, unsigned int type, unsigned int unit) return 0; } -static int ch_ioctl(struct inode * inode, struct file * file, +static long ch_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { scsi_changer *ch = file->private_data; @@ -887,8 +886,7 @@ static long ch_ioctl_compat(struct file * file, case CHIOINITELEM: case CHIOSVOLTAG: /* compatible */ - return ch_ioctl(NULL /* inode, unused */, - file, cmd, arg); + return ch_ioctl(file, cmd, arg); case CHIOGSTATUS32: { struct changer_element_status32 ces32; -- 1.5.3.8 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] Convert drivers/scsi/ch.c to use unlocked_ioctl
As of now, compat_ioctl already runs without the BKL, whereas ioctl runs with the BKL. This patch first converts changer_fops to use a .unlocked_ioctl member. It applies the same locking rationale than ch_ioctl_compat() uses to ch_ioctl(). Signed-off-by: Mathieu Segaud <[EMAIL PROTECTED]> Reviewed-by: Matthew Wilcox <[EMAIL PROTECTED]> --- drivers/scsi/ch.c | 18 -- 1 files changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c index 2311019..cead0f5 100644 --- a/drivers/scsi/ch.c +++ b/drivers/scsi/ch.c @@ -92,8 +92,7 @@ static int ch_probe(struct device *); static int ch_remove(struct device *); static int ch_open(struct inode * inode, struct file * filp); static int ch_release(struct inode * inode, struct file * filp); -static int ch_ioctl(struct inode * inode, struct file * filp, -unsigned int cmd, unsigned long arg); +static long ch_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); #ifdef CONFIG_COMPAT static long ch_ioctl_compat(struct file * filp, unsigned int cmd, unsigned long arg); @@ -130,12 +129,12 @@ static struct scsi_driver ch_template = static const struct file_operations changer_fops = { - .owner= THIS_MODULE, - .open = ch_open, - .release = ch_release, - .ioctl= ch_ioctl, + .owner = THIS_MODULE, + .open = ch_open, + .release= ch_release, + .unlocked_ioctl = ch_ioctl, #ifdef CONFIG_COMPAT - .compat_ioctl = ch_ioctl_compat, + .compat_ioctl = ch_ioctl_compat, #endif }; @@ -626,7 +625,7 @@ ch_checkrange(scsi_changer *ch, unsigned int type, unsigned int unit) return 0; } -static int ch_ioctl(struct inode * inode, struct file * file, +static long ch_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { scsi_changer *ch = file->private_data; @@ -887,8 +886,7 @@ static long ch_ioctl_compat(struct file * file, case CHIOINITELEM: case CHIOSVOLTAG: /* compatible */ - return ch_ioctl(NULL /* inode, unused */, - file, cmd, arg); + return ch_ioctl(file, cmd, arg); case CHIOGSTATUS32: { struct changer_element_status32 ces32; -- 1.5.3.8 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] Convert drivers/scsi/ch.c to use unlocked_ioctl
As of now, compat_ioctl already runs without the BKL, whereas ioctl runs with the BKL. This patch first converts changer_fops to use a .unlocked_ioctl member. It applies the same locking rationale than ch_ioctl_compat() uses to ch_ioctl(). Signed-off-by: Mathieu Segaud <[EMAIL PROTECTED]> Reviewed-by: Matthew Wilcox <[EMAIL PROTECTED]> --- drivers/scsi/ch.c | 18 -- 1 files changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c index 2311019..cead0f5 100644 --- a/drivers/scsi/ch.c +++ b/drivers/scsi/ch.c @@ -92,8 +92,7 @@ static int ch_probe(struct device *); static int ch_remove(struct device *); static int ch_open(struct inode * inode, struct file * filp); static int ch_release(struct inode * inode, struct file * filp); -static int ch_ioctl(struct inode * inode, struct file * filp, -unsigned int cmd, unsigned long arg); +static long ch_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); #ifdef CONFIG_COMPAT static long ch_ioctl_compat(struct file * filp, unsigned int cmd, unsigned long arg); @@ -130,12 +129,12 @@ static struct scsi_driver ch_template = static const struct file_operations changer_fops = { - .owner= THIS_MODULE, - .open = ch_open, - .release = ch_release, - .ioctl= ch_ioctl, + .owner = THIS_MODULE, + .open = ch_open, + .release= ch_release, + .unlocked_ioctl = ch_ioctl, #ifdef CONFIG_COMPAT - .compat_ioctl = ch_ioctl_compat, + .compat_ioctl = ch_ioctl_compat, #endif }; @@ -626,7 +625,7 @@ ch_checkrange(scsi_changer *ch, unsigned int type, unsigned int unit) return 0; } -static int ch_ioctl(struct inode * inode, struct file * file, +static long ch_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { scsi_changer *ch = file->private_data; @@ -887,8 +886,7 @@ static long ch_ioctl_compat(struct file * file, case CHIOINITELEM: case CHIOSVOLTAG: /* compatible */ - return ch_ioctl(NULL /* inode, unused */, - file, cmd, arg); + return ch_ioctl(file, cmd, arg); case CHIOGSTATUS32: { struct changer_element_status32 ces32; -- 1.5.3.8 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC on MODULE SUPPORT] hello, Rusty, Should we provide module information even if the kernel module compiled built-in with bzImage?
Vous m'avez dit récemment : > hello, Rusty: > I encountered a problem when modules compiled built-in with bzImage: > > open-iscsi is an iSCSI software, it has a userspace daemon(iscsid) and > a userspace mani tool(iscsiadm) and a kernel module > (scsi_transport_iscsi), > recently the kernel module has been accepted into the official kernel > release; since the module licensed with GPL, it could be compiled as > built-in, > > but when I compiled the module within the bzImage, the problem appeared: > > tux ~ # iscsid -f > iscsid: Missing or Invalid version from > /sys/module/scsi_transport_iscsi/version. Make sure a up to date > scsi_transport_iscsi module is loaded and a up todate version of > iscsid is running. Exiting... > > this is just because iscsid hope there's an external module could be > under /sys/module, and read the kernel module's version information, > but if the module compiled built-in, all its module information > discarded and it doesn't appeared under /sys/module/, that would break > iscsid. > > Now the problem is: > > Should we provide module information under > /sys/module//... even if the module compiled built-in > with bzImage? > Or just this module(scsi_transport_iscsi) should be marked with [M] only? > > if the former solution is preferred, I would be happy to work on > MODULE_INFO-like macros improvements with CONFIG_MODULE undefined. your userspace program is somewhat broken the userspace should not expect to find the version number in /sys/module, as this is used by the Linux kernel module subsystem. You should provide the required information in another way such as a /proc/ file (bad) or a /sys file (better, but no module stuff, this has no business with it). -- Mathieu -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] Convert drivers/char/agp/frontend.c to use unlocked_ioctl
As of now, agp_compat_ioctl already runs without the BKL. Mutual exclusion is enforced by agp_fe.agp_mutex in agp_ioctl() and agp_compat_ioctl(). Apply the same locking rationale to the two functions allowing BKL cleanup. Signed-off-by: Mathieu Segaud <[EMAIL PROTECTED]> --- drivers/char/agp/frontend.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/char/agp/frontend.c b/drivers/char/agp/frontend.c index 7791e98..6212a9e 100644 --- a/drivers/char/agp/frontend.c +++ b/drivers/char/agp/frontend.c @@ -960,7 +960,7 @@ static int agpioc_unbind_wrap(struct agp_file_private *priv, void __user *arg) return agp_unbind_memory(memory); } -static int agp_ioctl(struct inode *inode, struct file *file, +static long agp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { struct agp_file_private *curr_priv = file->private_data; @@ -1047,7 +1047,7 @@ static const struct file_operations agp_fops = .llseek = no_llseek, .read = agp_read, .write = agp_write, - .ioctl = agp_ioctl, + .unlocked_ioctl = agp_ioctl, #ifdef CONFIG_COMPAT .compat_ioctl = compat_agp_ioctl, #endif -- 1.5.3.8 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC on MODULE SUPPORT] hello, Rusty, Should we provide module information even if the kernel module compiled built-in with bzImage?
Vous m'avez dit récemment : > On Wednesday 16 January 2008 22:58:09 Mathieu SEGAUD wrote: >> your userspace program is somewhat broken >> the userspace should not expect to find the version number in >> /sys/module, as this is used by the Linux kernel module subsystem. You >> should provide the required information in another way such as a >> /proc/ file (bad) or a /sys file (better, but no module stuff, this >> has no business with it). > > Shh! He was going to implement a feature we want! > > To be honest, I think his expectations of consistency are correct: if a > version number makes sense, surely it makes sense for builtins as well. yep, I did not look out the way he suggested to do it; and sure that is a cool feature. sorry for that one. Sometimes it's difficult to part what should be done _in_ the kernel, what should be done _by_ the kernel, and userspace. thanks a lot -- Mathieu -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] Convert ext3_ioctl() to an unlocked_ioctl
Signed-off-by: Mathieu Segaud <[EMAIL PROTECTED]> --- fs/ext3/dir.c |2 +- fs/ext3/file.c |2 +- fs/ext3/ioctl.c | 159 -- include/linux/ext3_fs.h |3 +- 4 files changed, 113 insertions(+), 53 deletions(-) diff --git a/fs/ext3/dir.c b/fs/ext3/dir.c index 8ca3bfd..5ab6b88 100644 --- a/fs/ext3/dir.c +++ b/fs/ext3/dir.c @@ -42,7 +42,7 @@ const struct file_operations ext3_dir_operations = { .llseek = generic_file_llseek, .read = generic_read_dir, .readdir= ext3_readdir, /* we take BKL. needed?*/ - .ioctl = ext3_ioctl, /* BKL held */ + .unlocked_ioctl = ext3_ioctl, /* BKL held */ #ifdef CONFIG_COMPAT .compat_ioctl = ext3_compat_ioctl, #endif diff --git a/fs/ext3/file.c b/fs/ext3/file.c index acc4913..49798ed 100644 --- a/fs/ext3/file.c +++ b/fs/ext3/file.c @@ -112,7 +112,7 @@ const struct file_operations ext3_file_operations = { .write = do_sync_write, .aio_read = generic_file_aio_read, .aio_write = ext3_file_write, - .ioctl = ext3_ioctl, + .unlocked_ioctl = ext3_ioctl, #ifdef CONFIG_COMPAT .compat_ioctl = ext3_compat_ioctl, #endif diff --git a/fs/ext3/ioctl.c b/fs/ext3/ioctl.c index 023a070..9d57d47 100644 --- a/fs/ext3/ioctl.c +++ b/fs/ext3/ioctl.c @@ -17,12 +17,19 @@ #include #include -int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, +long ext3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { - struct ext3_inode_info *ei = EXT3_I(inode); + struct ext3_inode_info *ei; + struct inode *inode; unsigned int flags; unsigned short rsv_window_size; + long retval = 0; + + lock_kernel(); + + inode = filp->f_dentry->d_inode; + ei = EXT3_I(inode); ext3_debug ("cmd = %u, arg = %lu\n", cmd, arg); @@ -30,7 +37,8 @@ int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, case EXT3_IOC_GETFLAGS: ext3_get_inode_flags(ei); flags = ei->i_flags & EXT3_FL_USER_VISIBLE; - return put_user(flags, (int __user *) arg); + retval = put_user(flags, (int __user *) arg); + goto out; case EXT3_IOC_SETFLAGS: { handle_t *handle = NULL; int err; @@ -38,14 +46,20 @@ int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, unsigned int oldflags; unsigned int jflag; - if (IS_RDONLY(inode)) - return -EROFS; + if (IS_RDONLY(inode)) { + retval = -EROFS; + goto out; + } - if (!is_owner_or_cap(inode)) - return -EACCES; + if (!is_owner_or_cap(inode)) { + retval = -EACCES; + goto out; + } - if (get_user(flags, (int __user *) arg)) - return -EFAULT; + if (get_user(flags, (int __user *) arg)) { + retval = -EFAULT; + goto out; + } if (!S_ISDIR(inode->i_mode)) flags &= ~EXT3_DIRSYNC_FL; @@ -54,7 +68,8 @@ int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, /* Is it quota file? Do not allow user to mess with it */ if (IS_NOQUOTA(inode)) { mutex_unlock(&inode->i_mutex); - return -EPERM; + retval = -EPERM; + goto out; } oldflags = ei->i_flags; @@ -70,7 +85,8 @@ int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, if ((flags ^ oldflags) & (EXT3_APPEND_FL | EXT3_IMMUTABLE_FL)) { if (!capable(CAP_LINUX_IMMUTABLE)) { mutex_unlock(&inode->i_mutex); - return -EPERM; + retval = -EPERM; + goto out; } } @@ -81,7 +97,8 @@ int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, if ((jflag ^ oldflags) & (EXT3_JOURNAL_DATA_FL)) { if (!capable(CAP_SYS_RESOURCE)) { mutex_unlock(&inode->i_mutex); - return -EPERM; + retval = -EPERM; + goto out; } } @@ -89,7 +106,8 @@ int ext3_ioctl (struct inode * inode, struct file * filp, un
[PATCH] Convert ext4_ioctl to an unlocked_ioctl
Signed-off-by: Mathieu Segaud <[EMAIL PROTECTED]> --- fs/ext4/dir.c |2 +- fs/ext4/file.c |2 +- fs/ext4/ioctl.c | 159 --- include/linux/ext4_fs.h |3 +- 4 files changed, 112 insertions(+), 54 deletions(-) diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c index f612bef..8f6677a 100644 --- a/fs/ext4/dir.c +++ b/fs/ext4/dir.c @@ -42,7 +42,7 @@ const struct file_operations ext4_dir_operations = { .llseek = generic_file_llseek, .read = generic_read_dir, .readdir= ext4_readdir, /* we take BKL. needed?*/ - .ioctl = ext4_ioctl, /* BKL held */ + .unlocked_ioctl = ext4_ioctl, /* BKL held */ #ifdef CONFIG_COMPAT .compat_ioctl = ext4_compat_ioctl, #endif diff --git a/fs/ext4/file.c b/fs/ext4/file.c index 1a81cd6..34852a9 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c @@ -112,7 +112,7 @@ const struct file_operations ext4_file_operations = { .write = do_sync_write, .aio_read = generic_file_aio_read, .aio_write = ext4_file_write, - .ioctl = ext4_ioctl, + .unlocked_ioctl = ext4_ioctl, #ifdef CONFIG_COMPAT .compat_ioctl = ext4_compat_ioctl, #endif diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index e7f894b..a0ee342 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c @@ -17,12 +17,18 @@ #include #include -int ext4_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, - unsigned long arg) +long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { - struct ext4_inode_info *ei = EXT4_I(inode); + struct ext4_inode_info *ei; + struct inode *inode; unsigned int flags; unsigned short rsv_window_size; + long retval = 0; + + lock_kernel(); + + inode = filp->f_dentry->d_inode; + ei = EXT4_I(inode); ext4_debug ("cmd = %u, arg = %lu\n", cmd, arg); @@ -30,7 +36,8 @@ int ext4_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, case EXT4_IOC_GETFLAGS: ext4_get_inode_flags(ei); flags = ei->i_flags & EXT4_FL_USER_VISIBLE; - return put_user(flags, (int __user *) arg); + retval = put_user(flags, (int __user *) arg); + goto out; case EXT4_IOC_SETFLAGS: { handle_t *handle = NULL; int err; @@ -38,14 +45,20 @@ int ext4_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, unsigned int oldflags; unsigned int jflag; - if (IS_RDONLY(inode)) - return -EROFS; + if (IS_RDONLY(inode)) { + retval = -EROFS; + goto out; + } - if (!is_owner_or_cap(inode)) - return -EACCES; + if (!is_owner_or_cap(inode)) { + retval = -EACCES; + goto out; + } - if (get_user(flags, (int __user *) arg)) - return -EFAULT; + if (get_user(flags, (int __user *) arg)) { + retval = -EFAULT; + goto out; + } if (!S_ISDIR(inode->i_mode)) flags &= ~EXT4_DIRSYNC_FL; @@ -54,7 +67,8 @@ int ext4_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, /* Is it quota file? Do not allow user to mess with it */ if (IS_NOQUOTA(inode)) { mutex_unlock(&inode->i_mutex); - return -EPERM; + retval = -EPERM; + goto out; } oldflags = ei->i_flags; @@ -70,7 +84,8 @@ int ext4_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, if ((flags ^ oldflags) & (EXT4_APPEND_FL | EXT4_IMMUTABLE_FL)) { if (!capable(CAP_LINUX_IMMUTABLE)) { mutex_unlock(&inode->i_mutex); - return -EPERM; + retval = -EPERM; + goto out; } } @@ -81,7 +96,8 @@ int ext4_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, if ((jflag ^ oldflags) & (EXT4_JOURNAL_DATA_FL)) { if (!capable(CAP_SYS_RESOURCE)) { mutex_unlock(&inode->i_mutex); - return -EPERM; + retval = -EPERM; + goto out; } } @@ -89,7 +105,8 @@ int ext4_ioctl (struct inode *
[PATCH] Convert EXT2 to use unlocked_ioctl
Change ext_ioctl() to be an unlocked_ioctl(), explicitly exposing BKL's uses. Signed-off-by: Mathieu Segaud <[EMAIL PROTECTED]> --- fs/ext2/dir.c |2 +- fs/ext2/ext2.h |3 +- fs/ext2/file.c |4 +- fs/ext2/ioctl.c | 101 +- 4 files changed, 73 insertions(+), 37 deletions(-) diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c index d868e26..dbee3c9 100644 --- a/fs/ext2/dir.c +++ b/fs/ext2/dir.c @@ -703,7 +703,7 @@ const struct file_operations ext2_dir_operations = { .llseek = generic_file_llseek, .read = generic_read_dir, .readdir= ext2_readdir, - .ioctl = ext2_ioctl, + .unlocked_ioctl = ext2_ioctl, #ifdef CONFIG_COMPAT .compat_ioctl = ext2_compat_ioctl, #endif diff --git a/fs/ext2/ext2.h b/fs/ext2/ext2.h index c87ae29..bb9948c 100644 --- a/fs/ext2/ext2.h +++ b/fs/ext2/ext2.h @@ -139,8 +139,7 @@ int __ext2_write_begin(struct file *file, struct address_space *mapping, struct page **pagep, void **fsdata); /* ioctl.c */ -extern int ext2_ioctl (struct inode *, struct file *, unsigned int, - unsigned long); +extern long ext2_ioctl(struct file *, unsigned int, unsigned long); extern long ext2_compat_ioctl(struct file *, unsigned int, unsigned long); /* namei.c */ diff --git a/fs/ext2/file.c b/fs/ext2/file.c index c051798..17fe628 100644 --- a/fs/ext2/file.c +++ b/fs/ext2/file.c @@ -48,7 +48,7 @@ const struct file_operations ext2_file_operations = { .write = do_sync_write, .aio_read = generic_file_aio_read, .aio_write = generic_file_aio_write, - .ioctl = ext2_ioctl, + .unlocked_ioctl = ext2_ioctl, #ifdef CONFIG_COMPAT .compat_ioctl = ext2_compat_ioctl, #endif @@ -65,7 +65,7 @@ const struct file_operations ext2_xip_file_operations = { .llseek = generic_file_llseek, .read = xip_file_read, .write = xip_file_write, - .ioctl = ext2_ioctl, + .unlocked_ioctl = ext2_ioctl, #ifdef CONFIG_COMPAT .compat_ioctl = ext2_compat_ioctl, #endif diff --git a/fs/ext2/ioctl.c b/fs/ext2/ioctl.c index 320b2cb..02ba8e4 100644 --- a/fs/ext2/ioctl.c +++ b/fs/ext2/ioctl.c @@ -17,12 +17,18 @@ #include -int ext2_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, +long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { - struct ext2_inode_info *ei = EXT2_I(inode); + struct ext2_inode_info *ei; + struct inode *inode; unsigned int flags; unsigned short rsv_window_size; + long retval = 0; + + lock_kernel(); + inode = filp->f_dentry->d_inode; + ei = EXT2_I(inode); ext2_debug ("cmd = %u, arg = %lu\n", cmd, arg); @@ -30,18 +36,25 @@ int ext2_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, case EXT2_IOC_GETFLAGS: ext2_get_inode_flags(ei); flags = ei->i_flags & EXT2_FL_USER_VISIBLE; - return put_user(flags, (int __user *) arg); + retval = put_user(flags, (int __user *) arg); + goto out; case EXT2_IOC_SETFLAGS: { unsigned int oldflags; - if (IS_RDONLY(inode)) - return -EROFS; + if (IS_RDONLY(inode)) { + retval = -EROFS; + goto out; + } - if (!is_owner_or_cap(inode)) - return -EACCES; + if (!is_owner_or_cap(inode)) { + retval = -EACCES; + goto out; + } - if (get_user(flags, (int __user *) arg)) - return -EFAULT; + if (get_user(flags, (int __user *) arg)) { + retval = -EFAULT; + goto out; + } if (!S_ISDIR(inode->i_mode)) flags &= ~EXT2_DIRSYNC_FL; @@ -50,7 +63,8 @@ int ext2_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, /* Is it quota file? Do not allow user to mess with it */ if (IS_NOQUOTA(inode)) { mutex_unlock(&inode->i_mutex); - return -EPERM; + retval = -EPERM; + goto out; } oldflags = ei->i_flags; @@ -63,7 +77,8 @@ int ext2_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, if ((flags ^ oldflags) & (EXT2_APPEND_FL | EXT2_IMMUTABLE_FL)) { if (!capable(CAP_LINUX_IMMUTABLE)) { mutex_unlock(&inode->i_mutex); -
[PATCH] Convert reiserfs_ioctl() to an unlocked_ioctl
Signed-off-by: Mathieu Segaud <[EMAIL PROTECTED]> --- fs/reiserfs/dir.c |2 +- fs/reiserfs/file.c |2 +- fs/reiserfs/ioctl.c | 94 --- include/linux/reiserfs_fs.h |2 +- 4 files changed, 65 insertions(+), 35 deletions(-) diff --git a/fs/reiserfs/dir.c b/fs/reiserfs/dir.c index e6b03d2..f267cf9 100644 --- a/fs/reiserfs/dir.c +++ b/fs/reiserfs/dir.c @@ -20,7 +20,7 @@ const struct file_operations reiserfs_dir_operations = { .read = generic_read_dir, .readdir = reiserfs_readdir, .fsync = reiserfs_dir_fsync, - .ioctl = reiserfs_ioctl, + .unlocked_ioctl = reiserfs_ioctl, #ifdef CONFIG_COMPAT .compat_ioctl = reiserfs_compat_ioctl, #endif diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c index a804903..e4d415c 100644 --- a/fs/reiserfs/file.c +++ b/fs/reiserfs/file.c @@ -284,7 +284,7 @@ static ssize_t reiserfs_file_write(struct file *file, /* the file we are going t const struct file_operations reiserfs_file_operations = { .read = do_sync_read, .write = reiserfs_file_write, - .ioctl = reiserfs_ioctl, + .unlocked_ioctl = reiserfs_ioctl, #ifdef CONFIG_COMPAT .compat_ioctl = reiserfs_compat_ioctl, #endif diff --git a/fs/reiserfs/ioctl.c b/fs/reiserfs/ioctl.c index e0f0f09..5da64ab 100644 --- a/fs/reiserfs/ioctl.c +++ b/fs/reiserfs/ioctl.c @@ -21,80 +21,110 @@ static int reiserfs_unpack(struct inode *inode, struct file *filp); ** 2) REISERFS_IOC_[GS]ETFLAGS, REISERFS_IOC_[GS]ETVERSION ** 3) That's all for a while ... */ -int reiserfs_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) +long reiserfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { unsigned int flags; + struct inode *inode; + long retval = 0; + + lock_kernel(); + inode = filp->f_dentry->d_inode; switch (cmd) { case REISERFS_IOC_UNPACK: if (S_ISREG(inode->i_mode)) { if (arg) - return reiserfs_unpack(inode, filp); - else - return 0; + retval = reiserfs_unpack(inode, filp); } else - return -ENOTTY; + retval = -ENOTTY; + goto out; /* following two cases are taken from fs/ext2/ioctl.c by Remy Card ([EMAIL PROTECTED]) */ case REISERFS_IOC_GETFLAGS: - if (!reiserfs_attrs(inode->i_sb)) - return -ENOTTY; + if (!reiserfs_attrs(inode->i_sb)) { + retval = -ENOTTY; + goto out; + } flags = REISERFS_I(inode)->i_attrs; i_attrs_to_sd_attrs(inode, (__u16 *) & flags); - return put_user(flags, (int __user *)arg); + retval = put_user(flags, (int __user *)arg); + goto out; case REISERFS_IOC_SETFLAGS:{ - if (!reiserfs_attrs(inode->i_sb)) - return -ENOTTY; + if (!reiserfs_attrs(inode->i_sb)) { + retval = -ENOTTY; + goto out; + } - if (IS_RDONLY(inode)) - return -EROFS; + if (IS_RDONLY(inode)) { + retval = -EROFS; + goto out; + } - if (!is_owner_or_cap(inode)) - return -EPERM; + if (!is_owner_or_cap(inode)) { + retval = -EPERM; + goto out; + } - if (get_user(flags, (int __user *)arg)) - return -EFAULT; + if (get_user(flags, (int __user *)arg)) { + retval = -EFAULT; + goto out; + } /* Is it quota file? Do not allow user to mess with it. */ - if (IS_NOQUOTA(inode)) - return -EPERM; + if (IS_NOQUOTA(inode)) { + retval = -EPERM; + goto out; + } if (((flags ^ REISERFS_I(inode)-> i_attrs) & (REISERFS_IMMUTABLE_FL | REISERFS_APPEND_FL)) - && !capable(CAP_LINUX_IMMUTABLE)) - return -EPERM; + && !capable(
[PATCH] reiserfs: coding style fixes
Signed-off-by: Mathieu Segaud <[EMAIL PROTECTED]> --- fs/reiserfs/ioctl.c | 22 -- 1 files changed, 12 insertions(+), 10 deletions(-) diff --git a/fs/reiserfs/ioctl.c b/fs/reiserfs/ioctl.c index 5da64ab..36a886f 100644 --- a/fs/reiserfs/ioctl.c +++ b/fs/reiserfs/ioctl.c @@ -17,7 +17,8 @@ static int reiserfs_unpack(struct inode *inode, struct file *filp); ** reiserfs_ioctl - handler for ioctl for inode ** supported commands: ** 1) REISERFS_IOC_UNPACK - try to unpack tail from direct item into indirect -** and prevent packing file (argument arg has to be non-zero) +** and prevent packing file (argument arg has to be +** non-zero) ** 2) REISERFS_IOC_[GS]ETFLAGS, REISERFS_IOC_[GS]ETVERSION ** 3) That's all for a while ... */ @@ -47,7 +48,7 @@ long reiserfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) } flags = REISERFS_I(inode)->i_attrs; - i_attrs_to_sd_attrs(inode, (__u16 *) & flags); + i_attrs_to_sd_attrs(inode, (__u16 *) &flags); retval = put_user(flags, (int __user *)arg); goto out; case REISERFS_IOC_SETFLAGS:{ @@ -71,7 +72,10 @@ long reiserfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) goto out; } - /* Is it quota file? Do not allow user to mess with it. */ + /* +* Is it quota file? +* Do not allow user to mess with it. +*/ if (IS_NOQUOTA(inode)) { retval = -EPERM; goto out; @@ -184,9 +188,8 @@ static int reiserfs_unpack(struct inode *inode, struct file *filp) return 0; } /* ioctl already done */ - if (REISERFS_I(inode)->i_flags & i_nopack_mask) { + if (REISERFS_I(inode)->i_flags & i_nopack_mask) return 0; - } /* we need to make sure nobody is changing the file size beneath ** us @@ -202,16 +205,15 @@ static int reiserfs_unpack(struct inode *inode, struct file *filp) } /* we unpack by finding the page with the tail, and calling -** reiserfs_prepare_write on that page. This will force a +** reiserfs_prepare_write on that page. This will force a ** reiserfs_get_block to unpack the tail for us. */ index = inode->i_size >> PAGE_CACHE_SHIFT; mapping = inode->i_mapping; page = grab_cache_page(mapping, index); retval = -ENOMEM; - if (!page) { + if (!page) goto out; - } retval = reiserfs_prepare_write(NULL, page, write_from, write_from); if (retval) goto out_unlock; @@ -221,11 +223,11 @@ static int reiserfs_unpack(struct inode *inode, struct file *filp) retval = reiserfs_commit_write(NULL, page, write_from, write_from); REISERFS_I(inode)->i_flags |= i_nopack_mask; - out_unlock: +out_unlock: unlock_page(page); page_cache_release(page); - out: +out: mutex_unlock(&inode->i_mutex); reiserfs_write_unlock(inode->i_sb); return retval; -- 1.5.3.8 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Convert EXT2 to use unlocked_ioctl
Vous m'avez dit récemment : > On Thursday 17 January 2008, you wrote: >> >> Change ext_ioctl() to be an unlocked_ioctl(), explicitly >> exposing BKL's uses. >> >> Signed-off-by: Mathieu Segaud <[EMAIL PROTECTED]> > > You are now calling lock_kernel() twice in case of ext2_compat_ioctl(), > which calls back into ext2_ioctl with the BKL already held. > > This is allowed with the BKL, but really bad style that you should > avoid. I assume the ext3 and ext4dev versions of your patch have > the same issue, but I didn't check in detail. yep, they do. I noticed this nested calls. I guess I will add _extX_compat_ioctl() running with no BKL's which would be used by both extX_ioctl() and extX_compat_ioctl(). Any comments on such a strategy ? thanks a lot for the reminder :) -- Mathieu ps: I just posted a set of patches for reiserfs that may suffer the same ugly style -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Convert EXT2 to use unlocked_ioctl
Vous m'avez dit récemment : > Vous m'avez dit récemment : > >> On Thursday 17 January 2008, you wrote: >>> >>> Change ext_ioctl() to be an unlocked_ioctl(), explicitly >>> exposing BKL's uses. >>> >>> Signed-off-by: Mathieu Segaud <[EMAIL PROTECTED]> >> >> You are now calling lock_kernel() twice in case of ext2_compat_ioctl(), >> which calls back into ext2_ioctl with the BKL already held. >> >> This is allowed with the BKL, but really bad style that you should >> avoid. I assume the ext3 and ext4dev versions of your patch have >> the same issue, but I didn't check in detail. > > yep, they do. I noticed this nested calls. I guess I will add > _extX_compat_ioctl() running with no BKL's which would be used by both > extX_ioctl() and extX_compat_ioctl(). > Any comments on such a strategy ? thanks a lot for the reminder :) Well as I am not awake enough, this would sum up to get rid of lock/unlock_kernel() around extX_ioctl() calls... Will repost with theses changes. Thanks. -- Mathieu -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Convert EXT2 to use unlocked_ioctl
Vous m'avez dit récemment : > On Thursday 17 January 2008, Mathieu SEGAUD wrote: >> yep, they do. I noticed this nested calls. I guess I will add >> _extX_compat_ioctl() running with no BKL's which would be used by both >> extX_ioctl() and extX_compat_ioctl(). >> Any comments on such a strategy ? thanks a lot for the reminder :) >> > > Why not just kill the lock_kernel() in extX_compat_ioctl() ? sure, I just posted I wasn't that awake enough to see this one :) by the way thanks for the heads up. I repost the whole thing corrected. -- Mathieu -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] Convert ext3_ioctl() to an unlocked_ioctl
Signed-off-by: Mathieu Segaud <[EMAIL PROTECTED]> --- fs/ext3/dir.c |2 +- fs/ext3/file.c |2 +- fs/ext3/ioctl.c | 161 --- include/linux/ext3_fs.h |3 +- 4 files changed, 113 insertions(+), 55 deletions(-) diff --git a/fs/ext3/dir.c b/fs/ext3/dir.c index 8ca3bfd..5ab6b88 100644 --- a/fs/ext3/dir.c +++ b/fs/ext3/dir.c @@ -42,7 +42,7 @@ const struct file_operations ext3_dir_operations = { .llseek = generic_file_llseek, .read = generic_read_dir, .readdir= ext3_readdir, /* we take BKL. needed?*/ - .ioctl = ext3_ioctl, /* BKL held */ + .unlocked_ioctl = ext3_ioctl, /* BKL held */ #ifdef CONFIG_COMPAT .compat_ioctl = ext3_compat_ioctl, #endif diff --git a/fs/ext3/file.c b/fs/ext3/file.c index acc4913..49798ed 100644 --- a/fs/ext3/file.c +++ b/fs/ext3/file.c @@ -112,7 +112,7 @@ const struct file_operations ext3_file_operations = { .write = do_sync_write, .aio_read = generic_file_aio_read, .aio_write = ext3_file_write, - .ioctl = ext3_ioctl, + .unlocked_ioctl = ext3_ioctl, #ifdef CONFIG_COMPAT .compat_ioctl = ext3_compat_ioctl, #endif diff --git a/fs/ext3/ioctl.c b/fs/ext3/ioctl.c index 023a070..bccb372 100644 --- a/fs/ext3/ioctl.c +++ b/fs/ext3/ioctl.c @@ -17,12 +17,19 @@ #include #include -int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, +long ext3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { - struct ext3_inode_info *ei = EXT3_I(inode); + struct ext3_inode_info *ei; + struct inode *inode; unsigned int flags; unsigned short rsv_window_size; + long retval = 0; + + lock_kernel(); + + inode = filp->f_dentry->d_inode; + ei = EXT3_I(inode); ext3_debug ("cmd = %u, arg = %lu\n", cmd, arg); @@ -30,7 +37,8 @@ int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, case EXT3_IOC_GETFLAGS: ext3_get_inode_flags(ei); flags = ei->i_flags & EXT3_FL_USER_VISIBLE; - return put_user(flags, (int __user *) arg); + retval = put_user(flags, (int __user *) arg); + goto out; case EXT3_IOC_SETFLAGS: { handle_t *handle = NULL; int err; @@ -38,14 +46,20 @@ int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, unsigned int oldflags; unsigned int jflag; - if (IS_RDONLY(inode)) - return -EROFS; + if (IS_RDONLY(inode)) { + retval = -EROFS; + goto out; + } - if (!is_owner_or_cap(inode)) - return -EACCES; + if (!is_owner_or_cap(inode)) { + retval = -EACCES; + goto out; + } - if (get_user(flags, (int __user *) arg)) - return -EFAULT; + if (get_user(flags, (int __user *) arg)) { + retval = -EFAULT; + goto out; + } if (!S_ISDIR(inode->i_mode)) flags &= ~EXT3_DIRSYNC_FL; @@ -54,7 +68,8 @@ int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, /* Is it quota file? Do not allow user to mess with it */ if (IS_NOQUOTA(inode)) { mutex_unlock(&inode->i_mutex); - return -EPERM; + retval = -EPERM; + goto out; } oldflags = ei->i_flags; @@ -70,7 +85,8 @@ int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, if ((flags ^ oldflags) & (EXT3_APPEND_FL | EXT3_IMMUTABLE_FL)) { if (!capable(CAP_LINUX_IMMUTABLE)) { mutex_unlock(&inode->i_mutex); - return -EPERM; + retval = -EPERM; + goto out; } } @@ -81,7 +97,8 @@ int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, if ((jflag ^ oldflags) & (EXT3_JOURNAL_DATA_FL)) { if (!capable(CAP_SYS_RESOURCE)) { mutex_unlock(&inode->i_mutex); - return -EPERM; + retval = -EPERM; + goto out; } } @@ -89,7 +106,8 @@ int ext3_ioctl (struct inode * inode, struct file * filp, un
[PATCH] Convert ext4_ioctl to an unlocked_ioctl
Signed-off-by: Mathieu Segaud <[EMAIL PROTECTED]> --- fs/ext4/dir.c |2 +- fs/ext4/file.c |2 +- fs/ext4/ioctl.c | 161 --- include/linux/ext4_fs.h |3 +- 4 files changed, 112 insertions(+), 56 deletions(-) diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c index f612bef..8f6677a 100644 --- a/fs/ext4/dir.c +++ b/fs/ext4/dir.c @@ -42,7 +42,7 @@ const struct file_operations ext4_dir_operations = { .llseek = generic_file_llseek, .read = generic_read_dir, .readdir= ext4_readdir, /* we take BKL. needed?*/ - .ioctl = ext4_ioctl, /* BKL held */ + .unlocked_ioctl = ext4_ioctl, /* BKL held */ #ifdef CONFIG_COMPAT .compat_ioctl = ext4_compat_ioctl, #endif diff --git a/fs/ext4/file.c b/fs/ext4/file.c index 1a81cd6..34852a9 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c @@ -112,7 +112,7 @@ const struct file_operations ext4_file_operations = { .write = do_sync_write, .aio_read = generic_file_aio_read, .aio_write = ext4_file_write, - .ioctl = ext4_ioctl, + .unlocked_ioctl = ext4_ioctl, #ifdef CONFIG_COMPAT .compat_ioctl = ext4_compat_ioctl, #endif diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index e7f894b..27cab25 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c @@ -17,12 +17,18 @@ #include #include -int ext4_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, - unsigned long arg) +long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { - struct ext4_inode_info *ei = EXT4_I(inode); + struct ext4_inode_info *ei; + struct inode *inode; unsigned int flags; unsigned short rsv_window_size; + long retval = 0; + + lock_kernel(); + + inode = filp->f_dentry->d_inode; + ei = EXT4_I(inode); ext4_debug ("cmd = %u, arg = %lu\n", cmd, arg); @@ -30,7 +36,8 @@ int ext4_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, case EXT4_IOC_GETFLAGS: ext4_get_inode_flags(ei); flags = ei->i_flags & EXT4_FL_USER_VISIBLE; - return put_user(flags, (int __user *) arg); + retval = put_user(flags, (int __user *) arg); + goto out; case EXT4_IOC_SETFLAGS: { handle_t *handle = NULL; int err; @@ -38,14 +45,20 @@ int ext4_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, unsigned int oldflags; unsigned int jflag; - if (IS_RDONLY(inode)) - return -EROFS; + if (IS_RDONLY(inode)) { + retval = -EROFS; + goto out; + } - if (!is_owner_or_cap(inode)) - return -EACCES; + if (!is_owner_or_cap(inode)) { + retval = -EACCES; + goto out; + } - if (get_user(flags, (int __user *) arg)) - return -EFAULT; + if (get_user(flags, (int __user *) arg)) { + retval = -EFAULT; + goto out; + } if (!S_ISDIR(inode->i_mode)) flags &= ~EXT4_DIRSYNC_FL; @@ -54,7 +67,8 @@ int ext4_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, /* Is it quota file? Do not allow user to mess with it */ if (IS_NOQUOTA(inode)) { mutex_unlock(&inode->i_mutex); - return -EPERM; + retval = -EPERM; + goto out; } oldflags = ei->i_flags; @@ -70,7 +84,8 @@ int ext4_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, if ((flags ^ oldflags) & (EXT4_APPEND_FL | EXT4_IMMUTABLE_FL)) { if (!capable(CAP_LINUX_IMMUTABLE)) { mutex_unlock(&inode->i_mutex); - return -EPERM; + retval = -EPERM; + goto out; } } @@ -81,7 +96,8 @@ int ext4_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, if ((jflag ^ oldflags) & (EXT4_JOURNAL_DATA_FL)) { if (!capable(CAP_SYS_RESOURCE)) { mutex_unlock(&inode->i_mutex); - return -EPERM; + retval = -EPERM; + goto out; } } @@ -89,7 +105,8 @@ int ext4_ioctl (struct inode *
[PATCH] reiserfs: coding style fixes
Signed-off-by: Mathieu Segaud <[EMAIL PROTECTED]> --- fs/reiserfs/ioctl.c | 22 -- 1 files changed, 12 insertions(+), 10 deletions(-) diff --git a/fs/reiserfs/ioctl.c b/fs/reiserfs/ioctl.c index 691008d..1468be5 100644 --- a/fs/reiserfs/ioctl.c +++ b/fs/reiserfs/ioctl.c @@ -17,7 +17,8 @@ static int reiserfs_unpack(struct inode *inode, struct file *filp); ** reiserfs_ioctl - handler for ioctl for inode ** supported commands: ** 1) REISERFS_IOC_UNPACK - try to unpack tail from direct item into indirect -** and prevent packing file (argument arg has to be non-zero) +** and prevent packing file (argument arg has to be +** non-zero) ** 2) REISERFS_IOC_[GS]ETFLAGS, REISERFS_IOC_[GS]ETVERSION ** 3) That's all for a while ... */ @@ -47,7 +48,7 @@ long reiserfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) } flags = REISERFS_I(inode)->i_attrs; - i_attrs_to_sd_attrs(inode, (__u16 *) & flags); + i_attrs_to_sd_attrs(inode, (__u16 *) &flags); retval = put_user(flags, (int __user *)arg); goto out; case REISERFS_IOC_SETFLAGS:{ @@ -71,7 +72,10 @@ long reiserfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) goto out; } - /* Is it quota file? Do not allow user to mess with it. */ + /* +* Is it quota file? +* Do not allow user to mess with it. +*/ if (IS_NOQUOTA(inode)) { retval = -EPERM; goto out; @@ -182,9 +186,8 @@ static int reiserfs_unpack(struct inode *inode, struct file *filp) return 0; } /* ioctl already done */ - if (REISERFS_I(inode)->i_flags & i_nopack_mask) { + if (REISERFS_I(inode)->i_flags & i_nopack_mask) return 0; - } /* we need to make sure nobody is changing the file size beneath ** us @@ -200,16 +203,15 @@ static int reiserfs_unpack(struct inode *inode, struct file *filp) } /* we unpack by finding the page with the tail, and calling -** reiserfs_prepare_write on that page. This will force a +** reiserfs_prepare_write on that page. This will force a ** reiserfs_get_block to unpack the tail for us. */ index = inode->i_size >> PAGE_CACHE_SHIFT; mapping = inode->i_mapping; page = grab_cache_page(mapping, index); retval = -ENOMEM; - if (!page) { + if (!page) goto out; - } retval = reiserfs_prepare_write(NULL, page, write_from, write_from); if (retval) goto out_unlock; @@ -219,11 +221,11 @@ static int reiserfs_unpack(struct inode *inode, struct file *filp) retval = reiserfs_commit_write(NULL, page, write_from, write_from); REISERFS_I(inode)->i_flags |= i_nopack_mask; - out_unlock: +out_unlock: unlock_page(page); page_cache_release(page); - out: +out: mutex_unlock(&inode->i_mutex); reiserfs_write_unlock(inode->i_sb); return retval; -- 1.5.3.8 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] Convert reiserfs_ioctl() to an unlocked_ioctl
Signed-off-by: Mathieu Segaud <[EMAIL PROTECTED]> --- fs/reiserfs/dir.c |2 +- fs/reiserfs/file.c |2 +- fs/reiserfs/ioctl.c | 96 +++--- include/linux/reiserfs_fs.h |2 +- 4 files changed, 65 insertions(+), 37 deletions(-) diff --git a/fs/reiserfs/dir.c b/fs/reiserfs/dir.c index e6b03d2..f267cf9 100644 --- a/fs/reiserfs/dir.c +++ b/fs/reiserfs/dir.c @@ -20,7 +20,7 @@ const struct file_operations reiserfs_dir_operations = { .read = generic_read_dir, .readdir = reiserfs_readdir, .fsync = reiserfs_dir_fsync, - .ioctl = reiserfs_ioctl, + .unlocked_ioctl = reiserfs_ioctl, #ifdef CONFIG_COMPAT .compat_ioctl = reiserfs_compat_ioctl, #endif diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c index a804903..e4d415c 100644 --- a/fs/reiserfs/file.c +++ b/fs/reiserfs/file.c @@ -284,7 +284,7 @@ static ssize_t reiserfs_file_write(struct file *file, /* the file we are going t const struct file_operations reiserfs_file_operations = { .read = do_sync_read, .write = reiserfs_file_write, - .ioctl = reiserfs_ioctl, + .unlocked_ioctl = reiserfs_ioctl, #ifdef CONFIG_COMPAT .compat_ioctl = reiserfs_compat_ioctl, #endif diff --git a/fs/reiserfs/ioctl.c b/fs/reiserfs/ioctl.c index e0f0f09..691008d 100644 --- a/fs/reiserfs/ioctl.c +++ b/fs/reiserfs/ioctl.c @@ -21,80 +21,110 @@ static int reiserfs_unpack(struct inode *inode, struct file *filp); ** 2) REISERFS_IOC_[GS]ETFLAGS, REISERFS_IOC_[GS]ETVERSION ** 3) That's all for a while ... */ -int reiserfs_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) +long reiserfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { unsigned int flags; + struct inode *inode; + long retval = 0; + + lock_kernel(); + inode = filp->f_dentry->d_inode; switch (cmd) { case REISERFS_IOC_UNPACK: if (S_ISREG(inode->i_mode)) { if (arg) - return reiserfs_unpack(inode, filp); - else - return 0; + retval = reiserfs_unpack(inode, filp); } else - return -ENOTTY; + retval = -ENOTTY; + goto out; /* following two cases are taken from fs/ext2/ioctl.c by Remy Card ([EMAIL PROTECTED]) */ case REISERFS_IOC_GETFLAGS: - if (!reiserfs_attrs(inode->i_sb)) - return -ENOTTY; + if (!reiserfs_attrs(inode->i_sb)) { + retval = -ENOTTY; + goto out; + } flags = REISERFS_I(inode)->i_attrs; i_attrs_to_sd_attrs(inode, (__u16 *) & flags); - return put_user(flags, (int __user *)arg); + retval = put_user(flags, (int __user *)arg); + goto out; case REISERFS_IOC_SETFLAGS:{ - if (!reiserfs_attrs(inode->i_sb)) - return -ENOTTY; + if (!reiserfs_attrs(inode->i_sb)) { + retval = -ENOTTY; + goto out; + } - if (IS_RDONLY(inode)) - return -EROFS; + if (IS_RDONLY(inode)) { + retval = -EROFS; + goto out; + } - if (!is_owner_or_cap(inode)) - return -EPERM; + if (!is_owner_or_cap(inode)) { + retval = -EPERM; + goto out; + } - if (get_user(flags, (int __user *)arg)) - return -EFAULT; + if (get_user(flags, (int __user *)arg)) { + retval = -EFAULT; + goto out; + } /* Is it quota file? Do not allow user to mess with it. */ - if (IS_NOQUOTA(inode)) - return -EPERM; + if (IS_NOQUOTA(inode)) { + retval = -EPERM; + goto out; + } if (((flags ^ REISERFS_I(inode)-> i_attrs) & (REISERFS_IMMUTABLE_FL | REISERFS_APPEND_FL)) - && !capable(CAP_LINUX_IMMUTABLE)) - return -EPERM; + && !capable(
[PATCH] Convert EXT2 to use unlocked_ioctl
Change ext_ioctl() to be an unlocked_ioctl(), explicitly exposing BKL's uses. Signed-off-by: Mathieu Segaud <[EMAIL PROTECTED]> --- fs/ext2/dir.c |2 +- fs/ext2/ext2.h |3 +- fs/ext2/file.c |4 +- fs/ext2/ioctl.c | 103 +-- 4 files changed, 73 insertions(+), 39 deletions(-) diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c index d868e26..dbee3c9 100644 --- a/fs/ext2/dir.c +++ b/fs/ext2/dir.c @@ -703,7 +703,7 @@ const struct file_operations ext2_dir_operations = { .llseek = generic_file_llseek, .read = generic_read_dir, .readdir= ext2_readdir, - .ioctl = ext2_ioctl, + .unlocked_ioctl = ext2_ioctl, #ifdef CONFIG_COMPAT .compat_ioctl = ext2_compat_ioctl, #endif diff --git a/fs/ext2/ext2.h b/fs/ext2/ext2.h index c87ae29..bb9948c 100644 --- a/fs/ext2/ext2.h +++ b/fs/ext2/ext2.h @@ -139,8 +139,7 @@ int __ext2_write_begin(struct file *file, struct address_space *mapping, struct page **pagep, void **fsdata); /* ioctl.c */ -extern int ext2_ioctl (struct inode *, struct file *, unsigned int, - unsigned long); +extern long ext2_ioctl(struct file *, unsigned int, unsigned long); extern long ext2_compat_ioctl(struct file *, unsigned int, unsigned long); /* namei.c */ diff --git a/fs/ext2/file.c b/fs/ext2/file.c index c051798..17fe628 100644 --- a/fs/ext2/file.c +++ b/fs/ext2/file.c @@ -48,7 +48,7 @@ const struct file_operations ext2_file_operations = { .write = do_sync_write, .aio_read = generic_file_aio_read, .aio_write = generic_file_aio_write, - .ioctl = ext2_ioctl, + .unlocked_ioctl = ext2_ioctl, #ifdef CONFIG_COMPAT .compat_ioctl = ext2_compat_ioctl, #endif @@ -65,7 +65,7 @@ const struct file_operations ext2_xip_file_operations = { .llseek = generic_file_llseek, .read = xip_file_read, .write = xip_file_write, - .ioctl = ext2_ioctl, + .unlocked_ioctl = ext2_ioctl, #ifdef CONFIG_COMPAT .compat_ioctl = ext2_compat_ioctl, #endif diff --git a/fs/ext2/ioctl.c b/fs/ext2/ioctl.c index 320b2cb..0f18ac5 100644 --- a/fs/ext2/ioctl.c +++ b/fs/ext2/ioctl.c @@ -17,12 +17,18 @@ #include -int ext2_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, +long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { - struct ext2_inode_info *ei = EXT2_I(inode); + struct ext2_inode_info *ei; + struct inode *inode; unsigned int flags; unsigned short rsv_window_size; + long retval = 0; + + lock_kernel(); + inode = filp->f_path.dentry->d_inode; + ei = EXT2_I(inode); ext2_debug ("cmd = %u, arg = %lu\n", cmd, arg); @@ -30,18 +36,25 @@ int ext2_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, case EXT2_IOC_GETFLAGS: ext2_get_inode_flags(ei); flags = ei->i_flags & EXT2_FL_USER_VISIBLE; - return put_user(flags, (int __user *) arg); + retval = put_user(flags, (int __user *) arg); + goto out; case EXT2_IOC_SETFLAGS: { unsigned int oldflags; - if (IS_RDONLY(inode)) - return -EROFS; + if (IS_RDONLY(inode)) { + retval = -EROFS; + goto out; + } - if (!is_owner_or_cap(inode)) - return -EACCES; + if (!is_owner_or_cap(inode)) { + retval = -EACCES; + goto out; + } - if (get_user(flags, (int __user *) arg)) - return -EFAULT; + if (get_user(flags, (int __user *) arg)) { + retval = -EFAULT; + goto out; + } if (!S_ISDIR(inode->i_mode)) flags &= ~EXT2_DIRSYNC_FL; @@ -50,7 +63,8 @@ int ext2_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, /* Is it quota file? Do not allow user to mess with it */ if (IS_NOQUOTA(inode)) { mutex_unlock(&inode->i_mutex); - return -EPERM; + retval = -EPERM; + goto out; } oldflags = ei->i_flags; @@ -63,7 +77,8 @@ int ext2_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, if ((flags ^ oldflags) & (EXT2_APPEND_FL | EXT2_IMMUTABLE_FL)) { if (!capable(CAP_LINUX_IMMUTABLE)) { mutex_unlock(&inode->i_mutex); -
Re: [PATCH] Convert ext3_ioctl() to an unlocked_ioctl
Vous m'avez dit récemment : > --- a/fs/ext3/ioctl.c > +++ b/fs/ext3/ioctl.c > @@ -17,12 +17,19 @@ > #include > #include > > -int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, > +long ext3_ioctl(struct file *filp, unsigned int cmd, > unsigned long arg) > { > - struct ext3_inode_info *ei = EXT3_I(inode); > + struct ext3_inode_info *ei; > + struct inode *inode; > unsigned int flags; > unsigned short rsv_window_size; > + long retval = 0; > + > + lock_kernel(); > + > + inode = filp->f_dentry->d_inode; I guess this should be inode = filp->f_path.dentry->d_inode; I will repost a fixed patch sorry for this one. > + ei = EXT3_I(inode); > > ext3_debug ("cmd = %u, arg = %lu\n", cmd, arg); > -- Mathieu -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Convert ext4_ioctl to an unlocked_ioctl
Vous m'avez dit récemment : as well for this one, > --- a/fs/ext4/ioctl.c > +++ b/fs/ext4/ioctl.c > @@ -17,12 +17,18 @@ > #include > #include > > -int ext4_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, > - unsigned long arg) > +long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) > { > - struct ext4_inode_info *ei = EXT4_I(inode); > + struct ext4_inode_info *ei; > + struct inode *inode; > unsigned int flags; > unsigned short rsv_window_size; > + long retval = 0; > + > + lock_kernel(); > + > + inode = filp->f_dentry->d_inode; this should be inode = filp->f_path.dentry->d_inode; I will update this one too, sorry for this one as well :-) -- Mathieu -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: 2.6.11-rc4-mm1
Andrew Morton <[EMAIL PROTECTED]> disait derniÃrement que : > ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.11-rc4/2.6.11-rc4-mm1/ > > > - Various fixes and updates all over the place. Things seem to have slowed > down a bit. > > - Last, final, ultimate call: if anyone has patches in here which are 2.6.11 > material, please tell me. > > > > Changes since 2.6.11-rc3-mm1: [snip] > +inotify.patch > > Not sure if this is the latest version. it is the latest Robert Love posted against -mm kernels, but in inotify_ignore(): static int inotify_ignore(struct inotify_device *dev, s32 wd) { struct inotify_watch *watch; int ret = 0; spin_lock(&dev->lock); watch = dev_find_wd(dev, wd); spin_unlock(&dev->lock); <- lock is released, but if (!watch) { ret = -EINVAL; goto out; } __remove_watch(watch, dev); <-- must be called with lock held out: spin_unlock(&dev->lock); <- anyway, lock is return ret; released and sub_preempt_count } BUG's on SMP and PREEMPT __remove_watch() must be called with ->lock held on dev. Anyway, ->lock is released after label out. Signed-off-by: Mathieu Segaud <[EMAIL PROTECTED]> --- a/drivers/char/inotify.c 2005-02-23 11:55:21.321385752 +0100 +++ b/drivers/char/inotify.c 2005-02-23 11:55:29.772101048 +0100 @@ -952,7 +952,7 @@ spin_lock(&dev->lock); watch = dev_find_wd(dev, wd); - spin_unlock(&dev->lock); + if (!watch) { ret = -EINVAL; goto out; -- > Can you explain this behaviour? Yes -- Alan [Oh wait you want to know why...] - Alan Cox on linux-kernel
Re: 2.6.11-rc4-mm1 : IDE crazy numbers, hdb renumbered to hdq ?
Andrew Morton <[EMAIL PROTECTED]> disait derniÃrement que : > Helge Hafting <[EMAIL PROTECTED]> wrote: >> >> This kernel came up, but my boot script complained about no /dev/hdb3 >> when trying to mount /var. >> (I have two IDE disks on the same cable, and an IDE cdrom on another.) >> They are usually hda, hdb, and hdc. >> >> MAKEDEV hdq did not help. Looking at sysfs, it turns out that >> /dev/hdq1 is at major:3 minor:1025 if I interpret things right. >> (/dev/hda1 is at 3:1, which is correct.) >> These numbers did not work with my mknod, it created 7:1 instead. >> So I didn't get to test this mysterious device. >> >> But I assume this is a mistake of some sort, I haven't heard about any >> change in the IDE numbering coming up? 2.6.1-rc3-mm1 works as expected. >> >> It may be interesting to note that my root raid-1 came up fine, >> consisting of hdq1 and hda1 instead of the usual hdb1 and hda1. > > I don't know what could be causing that. Please send .config. If you set > CONFIG_BASE_FULL=n, try setting it to `y'. I've got the same problem here on my box, udev creates hds and hdu entries when running 2.6.11-rc4-mm1, whereas it creates correctly hdf et hdh, on other kernels. here follows .config: # # Automatically generated make config: don't edit # Linux kernel version: 2.6.11-rc4-mm1 # Wed Feb 23 22:11:44 2005 # CONFIG_X86=y CONFIG_MMU=y CONFIG_UID16=y CONFIG_GENERIC_ISA_DMA=y CONFIG_GENERIC_IOMAP=y # # Code maturity level options # CONFIG_EXPERIMENTAL=y CONFIG_CLEAN_COMPILE=y CONFIG_BROKEN_ON_SMP=y CONFIG_LOCK_KERNEL=y # # General setup # CONFIG_LOCALVERSION="" CONFIG_SWAP=y CONFIG_SYSVIPC=y CONFIG_POSIX_MQUEUE=y CONFIG_BSD_PROCESS_ACCT=y CONFIG_BSD_PROCESS_ACCT_V3=y CONFIG_SYSCTL=y # CONFIG_AUDIT is not set CONFIG_HOTPLUG=y CONFIG_KOBJECT_UEVENT=y CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y # CONFIG_EMBEDDED is not set CONFIG_KALLSYMS=y # CONFIG_KALLSYMS_ALL is not set # CONFIG_KALLSYMS_EXTRA_PASS is not set CONFIG_BASE_FULL=y CONFIG_BASE_SMALL=0 CONFIG_FUTEX=y CONFIG_EPOLL=y CONFIG_SHMEM=y CONFIG_CC_ALIGN_FUNCTIONS=0 CONFIG_CC_ALIGN_LABELS=0 CONFIG_CC_ALIGN_LOOPS=0 CONFIG_CC_ALIGN_JUMPS=0 # CONFIG_TINY_SHMEM is not set # # Loadable module support # CONFIG_MODULES=y CONFIG_MODULE_UNLOAD=y # CONFIG_MODULE_FORCE_UNLOAD is not set CONFIG_OBSOLETE_MODPARM=y # CONFIG_MODVERSIONS is not set # CONFIG_MODULE_SRCVERSION_ALL is not set CONFIG_KMOD=y # # Processor type and features # CONFIG_X86_PC=y # CONFIG_X86_ELAN is not set # CONFIG_X86_VOYAGER is not set # CONFIG_X86_NUMAQ is not set # CONFIG_X86_SUMMIT is not set # CONFIG_X86_BIGSMP is not set # CONFIG_X86_VISWS is not set # CONFIG_X86_GENERICARCH is not set # CONFIG_X86_ES7000 is not set # CONFIG_M386 is not set # CONFIG_M486 is not set # CONFIG_M586 is not set # CONFIG_M586TSC is not set # CONFIG_M586MMX is not set # CONFIG_M686 is not set # CONFIG_MPENTIUMII is not set # CONFIG_MPENTIUMIII is not set # CONFIG_MPENTIUMM is not set # CONFIG_MPENTIUM4 is not set # CONFIG_MK6 is not set CONFIG_MK7=y # CONFIG_MK8 is not set # CONFIG_MCRUSOE is not set # CONFIG_MEFFICEON is not set # CONFIG_MWINCHIPC6 is not set # CONFIG_MWINCHIP2 is not set # CONFIG_MWINCHIP3D is not set # CONFIG_MCYRIXIII is not set # CONFIG_MVIAC3_2 is not set # CONFIG_X86_GENERIC is not set CONFIG_X86_CMPXCHG=y CONFIG_X86_XADD=y CONFIG_X86_L1_CACHE_SHIFT=6 CONFIG_RWSEM_XCHGADD_ALGORITHM=y CONFIG_GENERIC_CALIBRATE_DELAY=y CONFIG_X86_WP_WORKS_OK=y CONFIG_X86_INVLPG=y CONFIG_X86_BSWAP=y CONFIG_X86_POPAD_OK=y CONFIG_X86_GOOD_APIC=y CONFIG_X86_INTEL_USERCOPY=y CONFIG_X86_USE_PPRO_CHECKSUM=y CONFIG_X86_USE_3DNOW=y # CONFIG_HPET_TIMER is not set # CONFIG_SMP is not set CONFIG_PREEMPT=y CONFIG_PREEMPT_BKL=y CONFIG_X86_UP_APIC=y CONFIG_X86_UP_IOAPIC=y CONFIG_X86_LOCAL_APIC=y CONFIG_X86_IO_APIC=y CONFIG_X86_TSC=y CONFIG_X86_MCE=y CONFIG_X86_MCE_NONFATAL=m # CONFIG_X86_MCE_P4THERMAL is not set # CONFIG_TOSHIBA is not set # CONFIG_I8K is not set # CONFIG_MICROCODE is not set # CONFIG_X86_MSR is not set # CONFIG_X86_CPUID is not set # # Firmware Drivers # # CONFIG_EDD is not set # CONFIG_NOHIGHMEM is not set CONFIG_HIGHMEM4G=y # CONFIG_HIGHMEM64G is not set CONFIG_HIGHMEM=y CONFIG_HIGHPTE=y # CONFIG_MATH_EMULATION is not set CONFIG_MTRR=y # CONFIG_EFI is not set CONFIG_HAVE_DEC_LOCK=y CONFIG_REGPARM=y CONFIG_SECCOMP=y # # Performance-monitoring counters support # # CONFIG_PERFCTR is not set CONFIG_PHYSICAL_START=0x10 CONFIG_KEXEC=y # # Power management options (ACPI, APM) # # CONFIG_PM is not set # # ACPI (Advanced Configuration and Power Interface) Support # CONFIG_ACPI=y CONFIG_ACPI_BOOT=y CONFIG_ACPI_INTERPRETER=y CONFIG_ACPI_AC=m CONFIG_ACPI_BATTERY=m CONFIG_ACPI_BUTTON=m # CONFIG_ACPI_VIDEO is not set CONFIG_ACPI_FAN=m CONFIG_ACPI_PROCESSOR=m CONFIG_ACPI_THERMAL=m # CONFIG_ACPI_ASUS is not set # CONFIG_ACPI_IBM is not set # CONFIG_ACPI_TOSHIBA is not set CONFIG_ACPI_PCC=m CONFIG_ACPI_SONY=m CONFIG_ACPI_BLACKLIST_YEAR=0 # CONFIG_ACPI_DEBUG is not set CONFIG_ACPI_BU
Re: Bigmem in Linux 2.6.8
Iwan Sanders <[EMAIL PROTECTED]> disait derniÃrement que : > Hi, > > I've got a quick question about the amount of memory used by Linux. > I compiled a 2.6.8 kernel on a machine with 2GB internal memory but > it seems to use only 882MB. Did I miss an option in the config file? you did, CONFIG_HIGHMEM must be set to y it is in "Processor type and features" section -- "The 'C' language can order structure members anyway it wants." - Richard B. Johnson - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: 2.6.11-rc5-mm1
Andrew Morton <[EMAIL PROTECTED]> disait derniÃrement que : > ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.11-rc5/2.6.11-rc5-mm1/ > > > - Lots of tuning/balancing changes in the CPU scheduler. Mainly targetted > at larger SMT/SMP/NUMA machines. It's going to be hard to work out whether > these are a net benefit. > > - A pcmcia update which obsoletes cardmgr (although cardmgr still works) and > makes pcmcia work more like regular hotpluggable devices. See the > changelong in pcmcia-dont-send-eject-request-events-to-userspace.patch for > details. > > - A new reiser4 code drop. By the way, I got an strange warning compiling fs/reiser4/plugin/ctail.c obvious fix is attached fs/reiser4/plugin/item/ctail.c: In function `check_ctail': fs/reiser4/plugin/item/ctail.c:250: attention : l'adresse de ÃÂ ctail_ok ÃÂ sera toujours ÃÂvaluÃÂe comme ÃÂtant ÃÂ true ÃÂ fs/reiser4/plugin/item/ctail.c: In function `convert_ctail': fs/reiser4/plugin/item/ctail.c:1669: attention : l'adresse de ÃÂ coord_is_unprepped_ctail ÃÂ sera toujours ÃÂvaluÃÂe comme ÃÂtant ÃÂ true ÃÂ Signed-off-by: Mathieu Segaud <[EMAIL PROTECTED]> --- fs/reiser4/plugin/item/ctail.c 2005-03-01 14:32:10.750179296 +0100 +++ fs/reiser4/plugin/item/ctail.c.new 2005-03-01 14:46:15.282790824 +0100 @@ -247,7 +247,7 @@ reiser4_internal int check_ctail (const coord_t * coord, const char **error) { - if (!ctail_ok) { + if (!ctail_ok(coord)) { if (error) *error = "bad cluster shift in ctail"; return 1; -- What would you expect to gain from XIP besides being buzzword compliant? - Erik Mouw on linux-arm-kernel
Re: 2.6.11-rc5-mm1
Mathieu Segaud <[EMAIL PROTECTED]> disait derniÃrement que : Hum, one hunk didn't make it. The complete patch is attached > > fs/reiser4/plugin/item/ctail.c: In function `check_ctail': > fs/reiser4/plugin/item/ctail.c:250: attention : l'adresse de ÃÂ ctail_ok > ÃÂ sera toujours ÃÂvaluÃÂe comme ÃÂtant ÃÂ true ÃÂ > fs/reiser4/plugin/item/ctail.c: In function `convert_ctail': > fs/reiser4/plugin/item/ctail.c:1669: attention : l'adresse de ÃÂ > coord_is_unprepped_ctail ÃÂ sera toujours ÃÂvaluÃÂe comme ÃÂtant ÃÂ > true ÃÂ > Signed-off-by: Mathieu Segaud <[EMAIL PROTECTED]> --- fs/reiser4/plugin/item/ctail.c 2005-03-01 14:57:52.756014040 +0100 +++ fs/reiser4/plugin/item/ctail.c.new 2005-03-01 14:57:19.791025480 +0100 @@ -247,7 +247,7 @@ reiser4_internal int check_ctail (const coord_t * coord, const char **error) { - if (!ctail_ok) { + if (!ctail_ok(coord)) { if (error) *error = "bad cluster shift in ctail"; return 1; @@ -1666,7 +1666,7 @@ detach_convert_idata(pos->sq); break; case CRC_OVERWRITE_ITEM: - if (coord_is_unprepped_ctail) { + if (coord_is_unprepped_ctail(&pos->coord)) { /* convert unpprepped ctail to prepped one */ int shift; shift = inode_cluster_shift(item_convert_data(pos)->inode); -- Outlook, n.: A virus delivery system with added email functionality. - Kurt Wall on linux-kernel
Re: 2.6.11-rc5-mm1
Mathieu Segaud <[EMAIL PROTECTED]> disait derniÃrement que : > Mathieu Segaud <[EMAIL PROTECTED]> disait derniÃrement que : > > Hum, one hunk didn't make it. > The complete patch is attached as any time I post with no sleep for 3 days, more noodles than brain are in my skull. Did tha wrong strip level, didn't I ? well, this the last one, with every hunk, and correct strip level --- linux/fs/reiser4/plugin/item/ctail.c 2005-03-01 14:57:52.756014040 +0100 +++ linux/fs/reiser4/plugin/item/ctail.c.new 2005-03-01 14:57:19.791025480 +0100 @@ -247,7 +247,7 @@ reiser4_internal int check_ctail (const coord_t * coord, const char **error) { - if (!ctail_ok) { + if (!ctail_ok(coord)) { if (error) *error = "bad cluster shift in ctail"; return 1; @@ -1666,7 +1666,7 @@ detach_convert_idata(pos->sq); break; case CRC_OVERWRITE_ITEM: - if (coord_is_unprepped_ctail) { + if (coord_is_unprepped_ctail(&pos->coord)) { /* convert unpprepped ctail to prepped one */ int shift; shift = inode_cluster_shift(item_convert_data(pos)->inode); Regards, time to go to bed -- > > > > Wait. Don't you mean: Yes. Just ignore me when I show extreme signs of Alzheimers. - Linus Torvalds on linux-kernel