From 39e6861997e34fd53785655561b393b54f7938d2 Mon Sep 17 00:00:00 2001 From: braam Date: Fri, 19 Oct 2001 18:54:07 +0000 Subject: [PATCH] This fixes a race between killing inodes in obdfs and in ext2obd. When files are kept open in obdfs it is important not to propagate the 0 link count to ext2obd since that would delete the inode prematurely. This one seems to run dbench 50 ok. --- lustre/obdfs/namei.c | 3 ++- lustre/obdfs/super.c | 18 +++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/lustre/obdfs/namei.c b/lustre/obdfs/namei.c index 87f04ad..4e297c6 100644 --- a/lustre/obdfs/namei.c +++ b/lustre/obdfs/namei.c @@ -59,10 +59,11 @@ static inline void ext2_inc_count(struct inode *inode) obdfs_change_inode(inode); } +/* postpone the disk update until the inode really goes away */ static inline void ext2_dec_count(struct inode *inode) { inode->i_nlink--; - obdfs_change_inode(inode); + // obdfs_change_inode(inode); } static inline int ext2_add_nondir(struct dentry *dentry, struct inode *inode) diff --git a/lustre/obdfs/super.c b/lustre/obdfs/super.c index b1869b8..e047218 100644 --- a/lustre/obdfs/super.c +++ b/lustre/obdfs/super.c @@ -341,7 +341,7 @@ static void obdfs_read_inode(struct inode *inode) return; } -void obdfs_change_inode(struct inode *inode) +void obdfs_do_change_inode(struct inode *inode, int mask) { struct obdo *oa; int err; @@ -359,7 +359,7 @@ void obdfs_change_inode(struct inode *inode) return; } - oa->o_valid = OBD_MD_FLNOTOBD; + oa->o_valid = OBD_MD_FLNOTOBD & (~mask); obdfs_from_inode(oa, inode); err = IOPS(inode, setattr)(IID(inode), oa); @@ -370,6 +370,12 @@ void obdfs_change_inode(struct inode *inode) obdo_free(oa); } /* obdfs_write_inode */ +void obdfs_change_inode(struct inode *inode, int mask) +{ + return obdfs_do_change_inode(inode, OBD_MD_FLNLINK); +} + + /* This routine is called from iput() (for each unlink on the inode). * We can't put this call into delete_inode() since that is called only @@ -391,6 +397,11 @@ static void obdfs_put_inode(struct inode *inode) static void obdfs_delete_inode(struct inode *inode) { + obdfs_do_change_inode(inode, 0); + clear_inode(inode); +} +#if 0 +{ struct obdo *oa; int err; @@ -424,7 +435,7 @@ static void obdfs_delete_inode(struct inode *inode) EXIT; } /* obdfs_delete_inode */ - +#endif int inode_copy_attr(struct inode * inode, struct iattr * attr) @@ -489,6 +500,7 @@ int obdfs_setattr(struct dentry *de, struct iattr *attr) } /* obdfs_setattr */ + static int obdfs_statfs(struct super_block *sb, struct statfs *buf) { struct statfs tmp; -- 1.8.3.1