From 5cba63eedbe73e9524666fa4f61ca1ece6ab509c Mon Sep 17 00:00:00 2001 From: alex Date: Wed, 31 Aug 2005 15:35:05 +0000 Subject: [PATCH] - as we don't set PG_writeback on pages being flushed, we need another way to support fsync(2). the simplest one is to wait for empty list lli_pending_write_llaps --- lustre/llite/file.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lustre/llite/file.c b/lustre/llite/file.c index fd24def..2adabe9 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -1664,6 +1664,8 @@ loff_t ll_file_seek(struct file *file, loff_t offset, int origin) int ll_fsync(struct file *file, struct dentry *dentry, int data) { struct inode *inode = dentry->d_inode; + struct ll_inode_info *lli = ll_i2info(inode); + struct address_space *mapping = inode->i_mapping; struct lov_stripe_md *lsm = ll_i2info(inode)->lli_smd; struct lustre_id id; struct ptlrpc_request *req; @@ -1678,6 +1680,12 @@ int ll_fsync(struct file *file, struct dentry *dentry, int data) * that IO to finish before calling the osc and mdc sync methods */ rc = filemap_fdatawait(inode->i_mapping); + /* 2.6 implements filemap_fdatawait() using PG_writeback which we + * don't support now. so, wait until all submited llaps are gone */ + if (ll_is_inode_dirty(mapping->host)) + CWARN("fsync() against "DLID4"\n", OLID4(&lli->lli_id)); + wait_event(lli->lli_dirty_wait, !ll_is_inode_dirty(mapping->host)); + ll_inode2id(&id, inode); err = md_sync(ll_i2sbi(inode)->ll_md_exp, &id, &req); if (!rc) -- 1.8.3.1