linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
* [linux-lvm] VFS locking patch fails on 2.4.4
@ 2001-04-28 14:38 Ed Tomlinson
  2001-04-28 21:00 ` [linux-lvm] " Chris Mason
  2001-04-30  1:53 ` Chris Mason
  0 siblings, 2 replies; 3+ messages in thread
From: Ed Tomlinson @ 2001-04-28 14:38 UTC (permalink / raw)
  To: linux-lvm; +Cc: Chris Mason

Hi,

The VFS locking patch fails on 2.4.4

oscar% cat ../LVM/linux-2.4.2-VFS-lock.patch | patch -p1
patching file drivers/md/lvm.c
Hunk #1 succeeded at 207 with fuzz 1 (offset 48 lines).
patching file fs/buffer.c
Hunk #1 succeeded at 331 (offset 17 lines).
patching file fs/super.c
patching file include/linux/fs.h
Hunk #1 FAILED at 1093.
1 out of 1 hunk FAILED -- saving rejects to file include/linux/fs.h.rej
patching file kernel/ksyms.c
Hunk #1 succeeded at 177 (offset 2 lines).

This worked with 2.4.4-pre8.  This is not too important (yet) since 
reiserfs snapshots also have problems.  They do not work with pre8.
I get the same messages as previously reported (using debian sid).

I know the lvm is going thru a major paradyne shift but hope to be
able to snapshot my reiserfs partn again soon.

TIA
Ed Tomlinson <tomlins@cam.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [linux-lvm] Re: VFS locking patch fails on 2.4.4
  2001-04-28 14:38 [linux-lvm] VFS locking patch fails on 2.4.4 Ed Tomlinson
@ 2001-04-28 21:00 ` Chris Mason
  2001-04-30  1:53 ` Chris Mason
  1 sibling, 0 replies; 3+ messages in thread
From: Chris Mason @ 2001-04-28 21:00 UTC (permalink / raw)
  To: Ed Tomlinson, linux-lvm


On Saturday, April 28, 2001 10:38:53 AM -0400 Ed Tomlinson
<tomlins@cam.org> wrote:

> Hi,
> 
> The VFS locking patch fails on 2.4.4
> 
> oscar% cat ../LVM/linux-2.4.2-VFS-lock.patch | patch -p1
> patching file drivers/md/lvm.c
> Hunk #1 succeeded at 207 with fuzz 1 (offset 48 lines).
> patching file fs/buffer.c
> Hunk #1 succeeded at 331 (offset 17 lines).
> patching file fs/super.c
> patching file include/linux/fs.h
> Hunk #1 FAILED at 1093.
> 1 out of 1 hunk FAILED -- saving rejects to file include/linux/fs.h.rej
> patching file kernel/ksyms.c
> Hunk #1 succeeded at 177 (offset 2 lines).
> 
> This worked with 2.4.4-pre8.  This is not too important (yet) since 
> reiserfs snapshots also have problems.  They do not work with pre8.
> I get the same messages as previously reported (using debian sid).

Viro fixed some races in buffer.c.  I'm updating the vfs locking patch now.

(just fyi so the the lvm guys don't duplicate effort ;-)

-chris

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [linux-lvm] Re: VFS locking patch fails on 2.4.4
  2001-04-28 14:38 [linux-lvm] VFS locking patch fails on 2.4.4 Ed Tomlinson
  2001-04-28 21:00 ` [linux-lvm] " Chris Mason
@ 2001-04-30  1:53 ` Chris Mason
  1 sibling, 0 replies; 3+ messages in thread
From: Chris Mason @ 2001-04-30  1:53 UTC (permalink / raw)
  To: Ed Tomlinson, linux-lvm

The only rejects were in fs.h, but here is a new patch against 2.4.4

diff -Nru a/drivers/md/lvm.c b/drivers/md/lvm.c
--- a/drivers/md/lvm.c	Sun Apr 29 20:48:50 2001
+++ b/drivers/md/lvm.c	Sun Apr 29 20:48:50 2001
@@ -207,7 +207,7 @@
 #define LOCAL_END_REQUEST
 
 /* lvm_do_lv_create calls fsync_dev_lockfs()/unlockfs() */
-/* #define	LVM_VFS_ENHANCEMENT */
+#define	LVM_VFS_ENHANCEMENT
 
 #include <linux/config.h>
 #include <linux/module.h>
diff -Nru a/fs/buffer.c b/fs/buffer.c
--- a/fs/buffer.c	Sun Apr 29 20:48:50 2001
+++ b/fs/buffer.c	Sun Apr 29 20:48:50 2001
@@ -331,6 +331,28 @@
 	return sync_buffers(dev, 1);
 }
 
+int fsync_dev_lockfs(kdev_t dev)
+{
+	sync_buffers(dev, 0);
+
+	lock_kernel();
+	sync_supers(dev);
+	/* 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);
diff -Nru a/fs/super.c b/fs/super.c
--- a/fs/super.c	Sun Apr 29 20:48:49 2001
+++ b/fs/super.c	Sun Apr 29 20:48:49 2001
@@ -630,6 +630,46 @@
 	}
 }
 
+/*
+ * Note: don't check the dirty flag before waiting, we want the lock
+ * to happen every time this is called.
+ */
+void sync_supers_lockfs(kdev_t dev)
+{
+	struct super_block * sb;
+
+	for (sb = sb_entry(super_blocks.next);
+	     sb != sb_entry(&super_blocks); 
+	     sb = sb_entry(sb->s_list.next)) {
+		if (!sb->s_dev)
+			continue;
+		if (dev && sb->s_dev != dev)
+			continue;
+		lock_super(sb);
+		if (sb->s_dev && (!dev || dev == sb->s_dev))
+			if (sb->s_op && sb->s_op->write_super_lockfs)
+				sb->s_op->write_super_lockfs(sb);
+		unlock_super(sb);
+	}
+}
+
+void unlockfs(kdev_t dev)
+{
+	struct super_block * sb;
+
+	for (sb = sb_entry(super_blocks.next);
+	     sb != sb_entry(&super_blocks); 
+	     sb = sb_entry(sb->s_list.next)) {
+		if (!sb->s_dev)
+			continue;
+		if (dev && sb->s_dev != dev)
+			continue;
+		if (sb->s_dev && (!dev || dev == sb->s_dev))
+			if (sb->s_op && sb->s_op->unlockfs)
+				sb->s_op->unlockfs(sb);
+	}
+}
+
 /**
  *	get_super	-	get the superblock of a device
  *	@dev: device to get the superblock for
diff -Nru a/include/linux/fs.h b/include/linux/fs.h
--- a/include/linux/fs.h	Sun Apr 29 20:48:50 2001
+++ b/include/linux/fs.h	Sun Apr 29 20:48:50 2001
@@ -1107,6 +1107,7 @@
 extern void write_inode_now(struct inode *, 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 void sync_inodes_sb(struct super_block *);
 extern int osync_inode_buffers(struct inode *);
@@ -1117,6 +1118,8 @@
 extern void filemap_fdatasync(struct address_space *);
 extern void 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);
diff -Nru a/kernel/ksyms.c b/kernel/ksyms.c
--- a/kernel/ksyms.c	Sun Apr 29 20:48:50 2001
+++ b/kernel/ksyms.c	Sun Apr 29 20:48:50 2001
@@ -179,6 +179,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(permission);
 EXPORT_SYMBOL(vfs_permission);
 EXPORT_SYMBOL(inode_setattr);

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-04-30  1:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-04-28 14:38 [linux-lvm] VFS locking patch fails on 2.4.4 Ed Tomlinson
2001-04-28 21:00 ` [linux-lvm] " Chris Mason
2001-04-30  1:53 ` Chris Mason

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).