Re: [PATCH/RFC] minix filesystem update to V3 for 2.6 kernels



Daniel Aragonés <danarag@xxxxxxxxx> wrote:

Hi Andrew,

As a continuation of my former communication of January 25, and after having posted the attached patch in my personal page http://www.terra.es/personal2/danarag for about 3 months, feedback has come
to me, and some bugs have been detected and corrected.

People use minixfs? I'm a bit surprised.

I believe that now (not before) the patch is really ready for merging into the main line if you consider it appropriate.

We'd need a detailed changelog please.

Signed-off-by: Daniel Aragones <danarag@xxxxxxxxx>

The patch gets lots of rejects. More than I'm prepared to fix up so I can
take a look at it in tkdiff, unfortunately.

I suspect the patch was against some prehistoric kernel like 2.6.16 ;)


@@ -79,24 +96,35 @@
int minix_new_block(struct inode * inode)
{
struct minix_sb_info *sbi = minix_sb(inode->i_sb);
- int i;
+ char *offset = kmalloc(sizeof(char *), GFP_KERNEL);

That's a peculiar thing to do.

+ int num_1K_blocks = (inode->i_sb->s_blocksize)/1024;
+ int bits_per_zone = 8 * (inode->i_sb->s_blocksize);
+ int i, k;

for (i = 0; i < sbi->s_zmap_blocks; i++) {
struct buffer_head *bh = sbi->s_zmap[i];
- int j;
+ for (k = 0; k < num_1K_blocks; k++) {
+ int j;

- lock_kernel();
- if ((j = minix_find_first_zero_bit(bh->b_data, 8192)) < 8192) {
- minix_set_bit(j,bh->b_data);
- unlock_kernel();
- mark_buffer_dirty(bh);
- j += i*8192 + sbi->s_firstdatazone-1;
- if (j < sbi->s_firstdatazone || j >= sbi->s_nzones)
- break;
- return j;
+ offset = (char *)bh->b_data;

And here I think we've just leaked that memory.

+ bit = ino & 8191;
+ ino >>= 13;
+ mask >>= (4-k);
+ if ((ino >> k) >= sbi->s_imap_blocks) {
printk("minix_free_inode: nonexistent imap in superblock\n");
goto out;
}

minix_clear_inode(inode); /* clear on-disk copy */

- bh = sbi->s_imap[ino >> 13];
+ char *offset = kmalloc(sizeof(char *), GFP_KERNEL);
+ bh = sbi->s_imap[ino >> k];
+ offset = (char *)bh->b_data;

And again. Here we've definitely leaked it.

@@ -226,26 +268,36 @@
j = 8192;
bh = NULL;
*error = -ENOSPC;
+ char *offset = kmalloc(sizeof(char *), GFP_KERNEL);
lock_kernel();
for (i = 0; i < sbi->s_imap_blocks; i++) {
bh = sbi->s_imap[i];
- if ((j = minix_find_first_zero_bit(bh->b_data, 8192)) < 8192)
- break;
+ for (k = 0; k < num_1K_blocks; k++) {
+ offset = (char *)bh->b_data;

again


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Re: [Ext2-devel] [PATCH 1/2] ext2/3: Support 2^32-1 blocks(Kernel)
    ... This has partially been addressed by Takashi's patch for fs-blocksize ... extent index block or another inode to allow storing larger EAs). ... At the same time, if we reserve too much space, it hurts EAs fitting ... think that the inode timestamps even warrant that protection. ...
    (Linux-Kernel)
  • Re: sysfs reclaim crash
    ... I don't have the pointer to d_inode ... to get the inode number. ... Though I was not able to recreate this race without the patch, ... sysfs_d_iputis invoked in dentry reclaim path under memory pressure. ...
    (Linux-Kernel)
  • [patch 3/4] Refactor do_syslog interface
    ... This patch breaks out the read operations in do_sysloginto their ... there were declarations of do_syslog and a ... static int kmsg_open(struct inode * inode, ... static int kmsg_release(struct inode * inode, struct file * file) ...
    (Linux-Kernel)
  • Re: [EXT4 set 7][PATCH 1/1]Remove 32000 subdirs limit.
    ... I have rebased this patch to 2.6.22-rc1 so that it can be added to the ... ext4 patch queue. ... Currently the maximum number of subdirectories is capped ... inode link count to 1 and no longer counts subdirectories. ...
    (Linux-Kernel)
  • Re: 2.6.22-rc2: known regressions with patches
    ... Patch: http://lkml.org/lkml/2007/5/12/93 ... Jeremy Fitzhardinge wrote: ... I doubt it will matter - I don't think we are marking the inode dirty at ... log I/O completion). ...
    (Linux-Kernel)