Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934907AbbEOV5D (ORCPT ); Fri, 15 May 2015 17:57:03 -0400 Received: from mailrelay101.isp.belgacom.be ([195.238.20.128]:37462 "EHLO mailrelay101.isp.belgacom.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934713AbbEOV5B (ORCPT ); Fri, 15 May 2015 17:57:01 -0400 X-Belgacom-Dynamic: yes X-Cloudmark-SP-Filtered: true X-Cloudmark-SP-Result: v=1.1 cv=aVuRYB9jFzFsbHnyIO6WTXMsFsysg296qeRS+2aVNsk= c=1 sm=2 a=Z4Rwk6OoAAAA:8 a=drOt6m5kAAAA:8 a=oHxjLTJgF5zxAUmsQpwA:9 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2AaBwBCa1ZV/yMoQ1dcgxCBMrJcBwEBAQEFAYEEmE2BM00BAQEBAQGBC4RQLyOBGjeIMAHXUiyGFoopHYQXBZI7ixmBJ44Ih1AjYWYBgjI8MYJGAQEB From: Fabian Frederick To: linux-kernel@vger.kernel.org Cc: Fabian Frederick , Andrew Morton , Alexander Viro , Jan Kara Subject: [PATCH V2 1/2 linux-next RESEND] affs: mark new inode before hashtable insertion Date: Fri, 15 May 2015 23:56:55 +0200 Message-Id: <1431727016-7191-1-git-send-email-fabf@skynet.be> X-Mailer: git-send-email 2.4.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2267 Lines: 86 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 Cc: Alexander Viro Cc: Jan Kara Suggested-by: Jan Kara Reviewed-by: Jan Kara Signed-off-by: Fabian Frederick --- V2: -remove insert_inode_hash() to avoid double insert -update patch subject fs/affs/inode.c | 4 ++-- fs/affs/namei.c | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/fs/affs/inode.c b/fs/affs/inode.c index 1734950..a9dbb41 100644 --- a/fs/affs/inode.c +++ b/fs/affs/inode.c @@ -323,8 +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; - - insert_inode_hash(inode); + if (insert_inode_locked(inode) < 0) + goto err_inode; return inode; 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; } -- 2.4.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/