aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruenba@redhat.com>2017-08-01 12:33:17 -0400
committerBob Peterson <rpeterso@redhat.com>2017-08-10 11:42:11 -0400
commiteebd2e813f7ef688e22cd0b68aea78fb3d1ef19c (patch)
tree625cbf8bb6aa687e252d18f36b81ddcbd64d82dc
parent0515480ad424f2d6853ffe448f444ba3c756c057 (diff)
gfs2: Get rid of gfs2_set_nlink
Remove gfs2_set_nlink which prevents the link count of an inode from becoming non-zero once it has reached zero. The next commit reduces the amount of waiting on glocks when an inode is evicted from memory. With that, an inode can become reallocated before all the remote-unlink callbacks from a previous delete are processed, which causes the link count to change from zero to non-zero. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> Signed-off-by: Bob Peterson <rpeterso@redhat.com>
-rw-r--r--fs/gfs2/glops.c28
1 files changed, 1 insertions, 27 deletions
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
index 28c203a02960..dac6559e2195 100644
--- a/fs/gfs2/glops.c
+++ b/fs/gfs2/glops.c
@@ -329,32 +329,6 @@ static int inode_go_demote_ok(const struct gfs2_glock *gl)
329 return 1; 329 return 1;
330} 330}
331 331
332/**
333 * gfs2_set_nlink - Set the inode's link count based on on-disk info
334 * @inode: The inode in question
335 * @nlink: The link count
336 *
337 * If the link count has hit zero, it must never be raised, whatever the
338 * on-disk inode might say. When new struct inodes are created the link
339 * count is set to 1, so that we can safely use this test even when reading
340 * in on disk information for the first time.
341 */
342
343static void gfs2_set_nlink(struct inode *inode, u32 nlink)
344{
345 /*
346 * We will need to review setting the nlink count here in the
347 * light of the forthcoming ro bind mount work. This is a reminder
348 * to do that.
349 */
350 if ((inode->i_nlink != nlink) && (inode->i_nlink != 0)) {
351 if (nlink == 0)
352 clear_nlink(inode);
353 else
354 set_nlink(inode, nlink);
355 }
356}
357
358static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf) 332static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf)
359{ 333{
360 const struct gfs2_dinode *str = buf; 334 const struct gfs2_dinode *str = buf;
@@ -376,7 +350,7 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf)
376 350
377 i_uid_write(&ip->i_inode, be32_to_cpu(str->di_uid)); 351 i_uid_write(&ip->i_inode, be32_to_cpu(str->di_uid));
378 i_gid_write(&ip->i_inode, be32_to_cpu(str->di_gid)); 352 i_gid_write(&ip->i_inode, be32_to_cpu(str->di_gid));
379 gfs2_set_nlink(&ip->i_inode, be32_to_cpu(str->di_nlink)); 353 set_nlink(&ip->i_inode, be32_to_cpu(str->di_nlink));
380 i_size_write(&ip->i_inode, be64_to_cpu(str->di_size)); 354 i_size_write(&ip->i_inode, be64_to_cpu(str->di_size));
381 gfs2_set_inode_blocks(&ip->i_inode, be64_to_cpu(str->di_blocks)); 355 gfs2_set_inode_blocks(&ip->i_inode, be64_to_cpu(str->di_blocks));
382 atime.tv_sec = be64_to_cpu(str->di_atime); 356 atime.tv_sec = be64_to_cpu(str->di_atime);