From 1bf2b2c3df71dfdd685e5b8f5709d5180902fa8f Mon Sep 17 00:00:00 2001 From: ericm Date: Wed, 3 Mar 2004 14:33:55 +0000 Subject: [PATCH] liblustre: - don't blindly drop inode - fix iget - root inode checking --- lustre/liblustre/file.c | 7 ++++--- lustre/liblustre/super.c | 12 ++++++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/lustre/liblustre/file.c b/lustre/liblustre/file.c index de3f35e..9a5162d 100644 --- a/lustre/liblustre/file.c +++ b/lustre/liblustre/file.c @@ -305,7 +305,8 @@ int llu_file_release(struct inode *inode) CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%lu\n", lli->lli_st_ino, lli->lli_st_generation); - /* XXX don't do anything for '/'. but how to find the root pnode? */ + if (llu_is_root_inode(inode)) + RETURN(0); /* still opened by others? */ if (--lli->lli_open_count) @@ -327,8 +328,8 @@ int llu_iop_close(struct inode *inode) int rc; rc = llu_file_release(inode); - if (!llu_i2info(inode)->lli_open_count) - llu_i2info(inode)->lli_stale_flag = 1; + /* if open count == 0 && stale_flag is set, should we + * remove the inode immediately? */ return rc; } diff --git a/lustre/liblustre/super.c b/lustre/liblustre/super.c index d3b6adf..82ab7ca 100644 --- a/lustre/liblustre/super.c +++ b/lustre/liblustre/super.c @@ -1236,12 +1236,15 @@ struct inode *llu_iget(struct filesys *fs, struct lustre_md *md) inode = _sysio_i_find(fs, &fileid); if (inode) { - if (llu_i2info(inode)->lli_st_generation == - md->body->generation) { + struct llu_inode_info *lli = llu_i2info(inode); + + if (lli->lli_stale_flag || + lli->lli_st_generation == md->body->generation) + I_RELE(inode); + else { llu_update_inode(inode, md->body, md->lsm); return inode; - } else - I_RELE(inode); + } } inode = llu_new_inode(fs, &fid); @@ -1494,3 +1497,4 @@ static struct inode_ops llu_inode_ops = { inop_gone: llu_iop_gone, }; +#warning "time_after() defined in liblustre.h need to be rewrite in userspace" -- 1.8.3.1