public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Fabian Frederick <fabf@skynet.be>
Cc: linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Alexander Viro <viro@zeniv.linux.org.uk>, Jan Kara <jack@suse.cz>
Subject: Re: [PATCH 1/2 linux-next] fs/affs/inode.c: mark new inode before hashtable insertion
Date: Wed, 6 May 2015 09:04:08 +0200	[thread overview]
Message-ID: <20150506070408.GA3872@quack.suse.cz> (raw)
In-Reply-To: <1430849170-1171-1-git-send-email-fabf@skynet.be>

On Tue 05-05-15 20:06:09, Fabian Frederick wrote:
> AFFS didn't mark new inode to I_NEW state like other FS
> using insert_inode_locked() during creation.
> This patch also unlocks inode when setup is complete
> or operation failed.
> 
> Problem appeared when trying to add tmpfile support.
> 
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Alexander Viro <viro@zeniv.linux.org.uk>
> Cc: Jan Kara <jack@suse.cz>
> Suggested-by: Jan Kara <jack@suse.cz>
> Signed-off-by: Fabian Frederick <fabf@skynet.be>
> ---
>  fs/affs/inode.c | 2 ++
>  fs/affs/namei.c | 6 ++++++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/fs/affs/inode.c b/fs/affs/inode.c
> index 1734950..859a9cb 100644
> --- a/fs/affs/inode.c
> +++ b/fs/affs/inode.c
> @@ -323,6 +323,8 @@ affs_new_inode(struct inode *dir)
>  	AFFS_I(inode)->i_pa_cnt = 0;
>  	AFFS_I(inode)->i_extcnt = 1;
>  	AFFS_I(inode)->i_ext_last = ~1;
> +	if (insert_inode_locked(inode) < 0)
> +		goto err_inode;
>  
>  	insert_inode_hash(inode);
  But you need to also remove insert_inode_hash() to avoid double insert.
Otherwise the patch looks good.

								Honza

>  
> diff --git a/fs/affs/namei.c b/fs/affs/namei.c
> index 181e05b..b183540 100644
> --- a/fs/affs/namei.c
> +++ b/fs/affs/namei.c
> @@ -281,9 +281,11 @@ affs_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool excl)
>  	error = affs_add_entry(dir, inode, dentry, ST_FILE);
>  	if (error) {
>  		clear_nlink(inode);
> +		unlock_new_inode(inode);
>  		iput(inode);
>  		return error;
>  	}
> +	unlock_new_inode(inode);
>  	return 0;
>  }
>  
> @@ -310,9 +312,11 @@ affs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
>  	if (error) {
>  		clear_nlink(inode);
>  		mark_inode_dirty(inode);
> +		unlock_new_inode(inode);
>  		iput(inode);
>  		return error;
>  	}
> +	unlock_new_inode(inode);
>  	return 0;
>  }
>  
> @@ -391,11 +395,13 @@ affs_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
>  	if (error)
>  		goto err;
>  
> +	unlock_new_inode(inode);
>  	return 0;
>  
>  err:
>  	clear_nlink(inode);
>  	mark_inode_dirty(inode);
> +	unlock_new_inode(inode);
>  	iput(inode);
>  	return error;
>  }
> -- 
> 1.9.1
> 
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

      parent reply	other threads:[~2015-05-06  7:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-05 18:06 [PATCH 1/2 linux-next] fs/affs/inode.c: mark new inode before hashtable insertion Fabian Frederick
2015-05-05 18:06 ` [PATCH 2/2 linux-next] AFFS: add tmpfile support Fabian Frederick
2015-05-06  7:34   ` Jan Kara
2015-05-06  7:04 ` Jan Kara [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150506070408.GA3872@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=fabf@skynet.be \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox