From afc10a1fc13ee11e841928898e08f68cd459b419 Mon Sep 17 00:00:00 2001 From: adilger Date: Thu, 12 Feb 2004 08:54:34 +0000 Subject: [PATCH] Update b_eq from HEAD (20040212_0003). (b_smallfix mostly) --- lustre/llite/llite_lib.c | 15 ++++++++++++++- lustre/smfs/file.c | 37 ++++++++++++++++++++++++++++--------- 2 files changed, 42 insertions(+), 10 deletions(-) diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index f0c778c..af7cbb7 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -650,11 +650,17 @@ static void lustre_manual_cleanup(struct ll_sb_info *sbi) void lustre_put_super(struct super_block *sb) { + struct obd_device *obd; struct ll_sb_info *sbi = ll_s2sbi(sb); + int force_umount = 0; ENTRY; CDEBUG(D_VFSTRACE, "VFS Op: sb %p\n", sb); - + obd = class_exp2obd(sbi->ll_mdc_exp); + if (obd) + force_umount = obd->obd_no_recov; + obd = NULL; + lustre_common_put_super(sb); if (sbi->ll_lmd != NULL) { @@ -663,6 +669,12 @@ void lustre_put_super(struct super_block *sb) int err; struct config_llog_instance cfg; + if (force_umount) { + CERROR("force umount, doing manual cleanup\n"); + lustre_manual_cleanup(sbi); + GOTO(free_lmd, 0); + } + cfg.cfg_instance = sbi->ll_instance; cfg.cfg_uuid = sbi->ll_sb_uuid; @@ -677,6 +689,7 @@ void lustre_put_super(struct super_block *sb) } OBD_FREE(cln_prof, len); + free_lmd: OBD_FREE(sbi->ll_lmd, sizeof(*sbi->ll_lmd)); OBD_FREE(sbi->ll_instance, strlen(sbi->ll_instance) + 1); } diff --git a/lustre/smfs/file.c b/lustre/smfs/file.c index e9afdd1..8263983 100644 --- a/lustre/smfs/file.c +++ b/lustre/smfs/file.c @@ -140,6 +140,8 @@ static ssize_t smfs_write (struct file *filp, const char *buf, struct inode *inode = dentry->d_inode; struct file open_file; struct dentry open_dentry; + loff_t tmp_ppos; + loff_t *cache_ppos; int rc = 0; ENTRY; @@ -149,13 +151,19 @@ static ssize_t smfs_write (struct file *filp, const char *buf, if (!cache_inode) RETURN(-ENOENT); + if (ppos != &(filp->f_pos)) { + cache_ppos = &tmp_ppos; + } else { + cache_ppos = &open_file.f_pos; + } + *cache_ppos = *ppos; + smfs_prepare_cachefile(inode, filp, cache_inode, &open_file, &open_dentry); - if (cache_inode->i_fop->write) - rc = cache_inode->i_fop->write(&open_file, buf, count, &open_file.f_pos); + rc = cache_inode->i_fop->write(&open_file, buf, count, cache_ppos); - *ppos = open_file.f_pos; + *ppos = *cache_ppos; duplicate_inode(cache_inode, inode); smfs_update_file(filp, &open_file); @@ -168,7 +176,7 @@ int smfs_ioctl(struct inode * inode, struct file * filp, struct dentry *dentry = filp->f_dentry; struct file open_file; struct dentry open_dentry; - ssize_t rc; + ssize_t rc = 0; ENTRY; @@ -195,7 +203,9 @@ static ssize_t smfs_read (struct file *filp, char *buf, struct inode *inode = dentry->d_inode; struct file open_file; struct dentry open_dentry; - ssize_t rc; + loff_t tmp_ppos; + loff_t *cache_ppos; + ssize_t rc = 0; ENTRY; @@ -203,13 +213,22 @@ static ssize_t smfs_read (struct file *filp, char *buf, if (!cache_inode) RETURN(-ENOENT); + if (ppos != &(filp->f_pos)) { + cache_ppos = &tmp_ppos; + } else { + cache_ppos = &open_file.f_pos; + } + *cache_ppos = *ppos; + + smfs_prepare_cachefile(inode, filp, cache_inode, &open_file, &open_dentry); + if (cache_inode->i_fop->read) - rc = cache_inode->i_fop->read(&open_file, buf, count, &open_file.f_pos); + rc = cache_inode->i_fop->read(&open_file, buf, count, cache_ppos); - *ppos = open_file.f_pos; + *ppos = *cache_ppos; duplicate_inode(cache_inode, inode); smfs_update_file(filp, &open_file); RETURN(rc); @@ -223,7 +242,7 @@ static loff_t smfs_llseek(struct file *file, struct dentry *dentry = file->f_dentry; struct file open_file; struct dentry open_dentry; - ssize_t rc; + ssize_t rc = 0; ENTRY; @@ -236,7 +255,7 @@ static loff_t smfs_llseek(struct file *file, if (cache_inode->i_fop->llseek) rc = cache_inode->i_fop->llseek(&open_file, offset, origin); - + duplicate_inode(cache_inode, dentry->d_inode); smfs_update_file(file, &open_file); -- 1.8.3.1