lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Thu, 10 Dec 2009 15:15:43 +0300
From:	Dmitry Monakhov <dmonakhov@...nvz.org>
To:	linux-ext4@...r.kernel.org
Cc:	aneesh.kumar@...ux.vnet.ibm.com, jack@...e.cz, cmm@...ibm.com
Subject: Re: [PATCH 2/2] ext4: Convert to generic reserved quota's space
 management.

Dmitry Monakhov <dmonakhov@...nvz.org> writes:

> This patch solves write vs chown race condition.
>
> Signed-off-by: Dmitry Monakhov <dmonakhov@...nvz.org>
> ---
>  fs/ext4/ext4.h  |    6 +++++-
>  fs/ext4/inode.c |   13 ++++---------
>  2 files changed, 9 insertions(+), 10 deletions(-)
Oops.. i've forgot to init EXT4_I(inode)->i_reserved_quota before usage.
This is strange, but this wasn't triggered by my simple test :(
Will send new version. 
>
> diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
> index 26d3cf8..992cecd 100644
> --- a/fs/ext4/ext4.h
> +++ b/fs/ext4/ext4.h
> @@ -705,6 +705,10 @@ struct ext4_inode_info {
>  	struct list_head i_aio_dio_complete_list;
>  	/* current io_end structure for async DIO write*/
>  	ext4_io_end_t *cur_aio_dio;
> +#ifdef CONFIG_QUOTA
> +	/* quota space reservation, managed internally by quota code */
> +	qsize_t i_reserved_quota;
> +#endif
>  };
>  
>  /*
> @@ -1427,7 +1431,7 @@ extern int ext4_chunk_trans_blocks(struct inode *, int nrblocks);
>  extern int ext4_block_truncate_page(handle_t *handle,
>  		struct address_space *mapping, loff_t from);
>  extern int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf);
> -extern qsize_t ext4_get_reserved_space(struct inode *inode);
> +extern qsize_t* ext4_get_reserved_space(struct inode *inode);
>  extern int flush_aio_dio_completed_IO(struct inode *inode);
>  /* ioctl.c */
>  extern long ext4_ioctl(struct file *, unsigned int, unsigned long);
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index f693768..d833e5a 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -1048,17 +1048,12 @@ out:
>  	return err;
>  }
>  
> -qsize_t ext4_get_reserved_space(struct inode *inode)
> +#ifdef CONFIG_QUOTA
> +qsize_t* ext4_get_reserved_space(struct inode *inode)
>  {
> -	unsigned long long total;
> -
> -	spin_lock(&EXT4_I(inode)->i_block_reservation_lock);
> -	total = EXT4_I(inode)->i_reserved_data_blocks +
> -		EXT4_I(inode)->i_reserved_meta_blocks;
> -	spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
> -
> -	return (total << inode->i_blkbits);
> +	return &EXT4_I(inode)->i_reserved_quota;
>  }
> +#endif
>  /*
>   * Calculate the number of metadata blocks need to reserve
>   * to allocate @blocks for non extent file based file
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ