Skip to contentSkip to conversation

updated lvm VFS locking patch 2.4.18-pre7

PATCH New Chris Mason 1 participant 1 message Jan 29, 2002

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 updated lvm VFS locking patch 2.4.18-pre7

Hello everyone,

2.4.18pre7 includes some super.c cleanups that trigger rejects on the lvm VFS locking patch for journaled filesystems.

This is against 2.4.18pre7 + lvm 1.0.2, I'm forwarding it to Marcelo later today.

-chris

Index: linus.21/fs/reiserfs/super.c

fs/reiserfs/super.c Mon, 28 Jan 2002 13:50:56 -0500 root (linux/41_super.c 1.2.2.1.2.1.1.1 644) renamed from fs/reiserfs/super.c Fri, 11 Jan 2002 10:14:59 -0500 root (linux/41_super.c 1.2.2.1.2.1.1.1 644) +1 -1
@@ -66,7 +66,7 @@
     reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), 1);
     journal_mark_dirty(&th, s, SB_BUFFER_WITH_SB (s));
     reiserfs_block_writes(&th) ;
-    journal_end(&th, s, 1) ;
+    journal_end_sync(&th, s, 1) ;
   }
   s->s_dirt = dirty;
   unlock_kernel() ;

Index: linus.21/fs/super.c

fs/super.c Mon, 28 Jan 2002 17:19:58 -0500 root (linux/d/45_super.c 1.6 644) renamed from fs/super.c Mon, 28 Jan 2002 09:51:50 -0500 root (linux/d/45_super.c 1.6 644) +63 -0

120 lines not on this page · raw message

Index: linus.21/fs/buffer.c

fs/buffer.c Mon, 28 Jan 2002 11:54:36 -0500 root (linux/i/45_buffer.c 1.5.2.6 644) renamed from fs/buffer.c Mon, 28 Jan 2002 09:51:50 -0500 root (linux/i/45_buffer.c 1.5.2.6 644) +28 -0
@@ -361,6 +361,34 @@
 	fsync_dev(dev);
 }
 
+int fsync_dev_lockfs(kdev_t dev)
+{
+	/* you are not allowed to try locking all the filesystems
+	** on the system, your chances of getting through without
+	** total deadlock are slim to none.
+	*/
+	if (!dev)
+		return fsync_dev(dev) ;
+
+	sync_buffers(dev, 0);
+
+	lock_kernel();
+	/* note, the FS might need to start transactions to 
+	** sync the inodes, or the quota, no locking until
+	** after these are done
+	*/
+	sync_inodes(dev);
+	DQUOT_SYNC(dev);
+	/* if inodes or quotas could be dirtied during the
+	** sync_supers_lockfs call, the FS is responsible for getting
+	** them on disk, without deadlocking against the lock
+	*/
+	sync_supers_lockfs(dev) ;
+	unlock_kernel();
+
+	return sync_buffers(dev, 1) ;
+}
+
 asmlinkage long sys_sync(void)
 {
 	fsync_dev(0);

Index: linus.21/drivers/md/lvm.c

drivers/md/lvm.c Mon, 28 Jan 2002 11:55:57 -0500 root (linux/h/c/34_lvm.c 1.5 644) renamed from drivers/md/lvm.c Mon, 28 Jan 2002 11:52:24 -0500 root (linux/h/c/34_lvm.c 1.5 644) +0 -9
@@ -223,9 +223,6 @@
 #define DEVICE_OFF(device)
 #define LOCAL_END_REQUEST
 
-/* lvm_do_lv_create calls fsync_dev_lockfs()/unlockfs() */
-/* #define	LVM_VFS_ENHANCEMENT */
-
 #include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
@@ -2107,12 +2104,8 @@
 	if (lv_ptr->lv_access & LV_SNAPSHOT) {
 		lv_t *org = lv_ptr->lv_snapshot_org, *last;
 
-		/* sync the original logical volume */
-		fsync_dev(org->lv_dev);
-#ifdef	LVM_VFS_ENHANCEMENT
 		/* VFS function call to sync and lock the filesystem */
 		fsync_dev_lockfs(org->lv_dev);
-#endif
 
 		down_write(&org->lv_lock);
 		org->lv_access |= LV_SNAPSHOT_ORG;
@@ -2137,11 +2130,9 @@
 	else
 		set_device_ro(lv_ptr->lv_dev, 1);
 
-#ifdef	LVM_VFS_ENHANCEMENT
 /* VFS function call to unlock the filesystem */
 	if (lv_ptr->lv_access & LV_SNAPSHOT)
 		unlockfs(lv_ptr->lv_snapshot_org->lv_dev);
-#endif
 
 	lvm_gendisk.part[MINOR(lv_ptr->lv_dev)].de =
 	    lvm_fs_create_lv(vg_ptr, lv_ptr);

Index: linus.21/kernel/ksyms.c

kernel/ksyms.c Mon, 28 Jan 2002 11:54:36 -0500 root (linux/m/c/25_ksyms.c 1.5.2.4 644) renamed from kernel/ksyms.c Mon, 28 Jan 2002 09:51:50 -0500 root (linux/m/c/25_ksyms.c 1.5.2.4 644) +2 -0
@@ -178,6 +178,8 @@
 EXPORT_SYMBOL(invalidate_inode_pages);
 EXPORT_SYMBOL(truncate_inode_pages);
 EXPORT_SYMBOL(fsync_dev);
+EXPORT_SYMBOL(fsync_dev_lockfs);
+EXPORT_SYMBOL(unlockfs);
 EXPORT_SYMBOL(fsync_no_super);
 EXPORT_SYMBOL(permission);
 EXPORT_SYMBOL(vfs_permission);

Index: linus.21/include/linux/fs.h

include/linux/fs.h Mon, 28 Jan 2002 12:15:21 -0500 root (linux/e/d/3_fs.h 1.2.1.1.1.3.3.1.1.2 644) renamed from include/linux/fs.h Mon, 28 Jan 2002 09:51:50 -0500 root (linux/e/d/3_fs.h 1.2.1.1.1.3.3.1.1.2 644) +3 -0
@@ -1205,6 +1205,7 @@
 extern int sync_buffers(kdev_t, int);
 extern void sync_dev(kdev_t);
 extern int fsync_dev(kdev_t);
+extern int fsync_dev_lockfs(kdev_t);
 extern int fsync_super(struct super_block *);
 extern int fsync_no_super(kdev_t);
 extern void sync_inodes_sb(struct super_block *);
@@ -1216,6 +1217,8 @@
 extern int filemap_fdatasync(struct address_space *);
 extern int filemap_fdatawait(struct address_space *);
 extern void sync_supers(kdev_t);
+extern void sync_supers_lockfs(kdev_t);
+extern void unlockfs(kdev_t);
 extern int bmap(struct inode *, int);
 extern int notify_change(struct dentry *, struct iattr *);
 extern int permission(struct inode *, int);