From: Steven Whitehouse Date: Wed, 15 Apr 2009 11:15:09 +0100 Subject: [Cluster-devel] [PATCH 2/5] GFS2: Fix symlink creation race In-Reply-To: <1239790512-2917-2-git-send-email-swhiteho@redhat.com> References: <1239790512-2917-1-git-send-email-swhiteho@redhat.com> <1239790512-2917-2-git-send-email-swhiteho@redhat.com> Message-ID: <1239790512-2917-3-git-send-email-swhiteho@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit In certain cases symlinks can appear to have zero size if a lookup on the inode occurs within a certain (very short) time after the symlink has been created. The symlink is correctly created on disk but appears to have zero size when stat()ed. This patch closes the race and prevents incorrect sizes appearing. Signed-off-by: Steven Whitehouse diff --git a/fs/gfs2/ops_inode.c b/fs/gfs2/ops_inode.c index abd5429..1c70fa5 100644 --- a/fs/gfs2/ops_inode.c +++ b/fs/gfs2/ops_inode.c @@ -371,6 +371,7 @@ static int gfs2_symlink(struct inode *dir, struct dentry *dentry, ip = ghs[1].gh_gl->gl_object; ip->i_disksize = size; + i_size_write(inode, size); error = gfs2_meta_inode_buffer(ip, &dibh); -- 1.6.0.6