[PATCH v2 19/35] ubifs: budget for inode in ubifs_dirty_inode if necessary

Richard Weinberger richard at nod.at
Mon Aug 3 14:13:47 PDT 2015


Am 30.07.2015 um 07:48 schrieb Dongsheng Yang:
> In ubifs, we have to do a budget for inode before marking
> it as dirty. But sometimes, we would call dirty_inode in vfs
> which will not do a budget for inode. In this case, we have
> to do a budget in ubifs_dirty_inode() by ourselvies.

How is this commit related to quota support?

> Signed-off-by: Dongsheng Yang <yangds.fnst at cn.fujitsu.com>
> ---
>  fs/ubifs/super.c | 25 ++++++++++++++++++++++++-
>  1 file changed, 24 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
> index 2491fff..bc57685 100644
> --- a/fs/ubifs/super.c
> +++ b/fs/ubifs/super.c
> @@ -383,15 +383,38 @@ done:
>  	clear_inode(inode);
>  }
>  
> +/*
> + * In theory, ubifs should take the full control of dirty<->clean
> + * of an inode with ui->ui_mutex. But there are callers of
> + * ubifs_dirty_inode in vfs without holding ui->ui_mutex and
> + * budgeting. So when we found the ui_mutex is not locked, we have
> + * to lock ui->ui_mutex by itself and do a budget by itself.
> + */
>  static void ubifs_dirty_inode(struct inode *inode, int flags)
>  {
>          struct ubifs_inode *ui = ubifs_inode(inode);
> +	int locked = mutex_is_locked(&ui->ui_mutex);
> +	struct ubifs_info *c = inode->i_sb->s_fs_info;
> +	int ret = 0;
> +
> +	if (!locked)
> +		mutex_lock(&ui->ui_mutex);
>  
> -	ubifs_assert(mutex_is_locked(&ui->ui_mutex));

So, currently this assert can be reached? How?

Thanks,
//richard



More information about the linux-mtd mailing list