Little research how rm -rf and tar kill server
Konstantin Belousov
kostikbel at gmail.com
Thu Apr 2 21:02:50 UTC 2015
On Thu, Apr 02, 2015 at 01:13:51AM +0300, Artem Kuchin wrote:
> 31.03.2015 19:42, Konstantin Belousov пишет:
> > Syncer and sync(2) perform different kind of syncs. Take the snapshot of
> > sysctl debug.softdep before and after the situation occur to have some
> > hints what is going on.
> >
> >
>
> Okay. Here is the sysctl data
Try this. It may be not enough, I will provide some update in this case.
No need to resend the sysctl data. Just test whether explicit sync(2) is
needed in your situation after the patch.
diff --git a/sys/ufs/ffs/ffs_extern.h b/sys/ufs/ffs/ffs_extern.h
index c29e5d5..8494223 100644
--- a/sys/ufs/ffs/ffs_extern.h
+++ b/sys/ufs/ffs/ffs_extern.h
@@ -160,7 +160,7 @@ void softdep_journal_fsync(struct inode *);
void softdep_buf_append(struct buf *, struct workhead *);
void softdep_inode_append(struct inode *, struct ucred *, struct workhead *);
void softdep_freework(struct workhead *);
-
+int softdep_need_sbupdate(struct ufsmount *ump);
/*
* Things to request flushing in softdep_request_cleanup()
diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c
index ab2bd41..e6ed696 100644
--- a/sys/ufs/ffs/ffs_softdep.c
+++ b/sys/ufs/ffs/ffs_softdep.c
@@ -612,6 +612,13 @@ softdep_freework(wkhd)
panic("softdep_freework called");
}
+int
+softdep_need_sbupdate(ump)
+ struct ufsmount *ump;
+{
+
+ panic("softdep_need_sbupdate called");
+}
#else
FEATURE(softupdates, "FFS soft-updates support");
@@ -9479,6 +9486,18 @@ first_unlinked_inodedep(ump)
return (inodedep);
}
+int
+softdep_need_sbupdate(ump)
+ struct ufsmount *ump;
+{
+ struct inodedep *inodedep;
+
+ ACQUIRE_LOCK(ump);
+ inodedep = first_unlinked_inodedep(ump);
+ FREE_LOCK(ump);
+ return (inodedep != NULL);
+}
+
/*
* Set the sujfree unlinked head pointer prior to writing a superblock.
*/
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index 6e2e556..b2973a2 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -1419,6 +1419,7 @@ static int
ffs_sync_lazy(mp)
struct mount *mp;
{
+ struct ufsmount *ump;
struct vnode *mvp, *vp;
struct inode *ip;
struct thread *td;
@@ -1461,9 +1462,13 @@ qupdate:
qsync(mp);
#endif
- if (VFSTOUFS(mp)->um_fs->fs_fmod != 0 &&
- (error = ffs_sbupdate(VFSTOUFS(mp), MNT_LAZY, 0)) != 0)
- allerror = error;
+ ump = VFSTOUFS(mp);
+ if (ump->um_fs->fs_fmod != 0 || (MOUNTEDSUJ(mp) &&
+ softdep_need_sbupdate(ump))) {
+ error = ffs_sbupdate(ump, MNT_LAZY, 0);
+ if (error != 0)
+ allerror = error;
+ }
return (allerror);
}
More information about the freebsd-fs
mailing list