1 Index: linux-2.4/drivers/evms/evms.c
2 --- linux-2.4/drivers/evms/evms.c 8 Mar 2002 23:50:12 -0000
3 +++ linux-2.4/drivers/evms/evms.c 11 Mar 2002 16:14:27 -0000
5 #include <linux/compiler.h>
6 #include <linux/evms/evms_kernel.h>
8 -//#define VFS_PATCH_PRESENT
9 +#define VFS_PATCH_PRESENT
11 /* prefix used in logging messages */
13 diff -Nru a/drivers/md/lvm.c b/drivers/md/lvm.c
14 --- a/drivers/md/lvm.c Wed May 22 10:43:49 2002
15 +++ b/drivers/md/lvm.c Wed May 22 10:43:49 2002
17 #define DEVICE_OFF(device)
18 #define LOCAL_END_REQUEST
20 -/* lvm_do_lv_create calls fsync_dev_lockfs()/unlockfs() */
21 -/* #define LVM_VFS_ENHANCEMENT */
23 #include <linux/config.h>
24 #include <linux/module.h>
25 #include <linux/kernel.h>
26 @@ -2178,12 +2175,8 @@
27 if (lv_ptr->lv_access & LV_SNAPSHOT) {
28 lv_t *org = lv_ptr->lv_snapshot_org, *last;
30 - /* sync the original logical volume */
31 - fsync_dev(org->lv_dev);
32 -#ifdef LVM_VFS_ENHANCEMENT
33 /* VFS function call to sync and lock the filesystem */
34 fsync_dev_lockfs(org->lv_dev);
37 down_write(&org->lv_lock);
38 org->lv_access |= LV_SNAPSHOT_ORG;
39 @@ -2209,11 +2202,9 @@
41 set_device_ro(lv_ptr->lv_dev, 1);
43 -#ifdef LVM_VFS_ENHANCEMENT
44 /* VFS function call to unlock the filesystem */
45 if (lv_ptr->lv_access & LV_SNAPSHOT)
46 unlockfs(lv_ptr->lv_snapshot_org->lv_dev);
49 lvm_gendisk.part[MINOR(lv_ptr->lv_dev)].de =
50 lvm_fs_create_lv(vg_ptr, lv_ptr);
51 diff -Nru a/fs/buffer.c b/fs/buffer.c
52 --- a/fs/buffer.c Wed May 22 10:43:49 2002
53 +++ b/fs/buffer.c Wed May 22 10:43:49 2002
58 +int fsync_dev_lockfs(kdev_t dev)
60 + /* you are not allowed to try locking all the filesystems
61 + ** on the system, your chances of getting through without
62 + ** total deadlock are slim to none.
65 + return fsync_dev(dev) ;
67 + sync_buffers(dev, 0);
70 + /* note, the FS might need to start transactions to
71 + ** sync the inodes, or the quota, no locking until
72 + ** after these are done
75 + DQUOT_SYNC_DEV(dev);
76 + /* if inodes or quotas could be dirtied during the
77 + ** sync_supers_lockfs call, the FS is responsible for getting
78 + ** them on disk, without deadlocking against the lock
80 + sync_supers_lockfs(dev) ;
83 + return sync_buffers(dev, 1) ;
86 asmlinkage long sys_sync(void)
89 diff -Nru a/fs/reiserfs/super.c b/fs/reiserfs/super.c
90 --- a/fs/reiserfs/super.c Wed May 22 10:43:49 2002
91 +++ b/fs/reiserfs/super.c Wed May 22 10:43:49 2002
93 reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), 1);
94 journal_mark_dirty(&th, s, SB_BUFFER_WITH_SB (s));
95 reiserfs_block_writes(&th) ;
96 - journal_end(&th, s, 1) ;
97 + journal_end_sync(&th, s, 1) ;
101 diff -Nru a/fs/super.c b/fs/super.c
102 --- a/fs/super.c Wed May 22 10:43:49 2002
103 +++ b/fs/super.c Wed May 22 10:43:49 2002
105 LIST_HEAD(super_blocks);
106 spinlock_t sb_lock = SPIN_LOCK_UNLOCKED;
109 + * lock/unlockfs grab a read lock on s_umount, but you need this lock to
110 + * make sure no lockfs runs are in progress before inserting/removing
111 + * supers from the list.
113 +static DECLARE_MUTEX(lockfs_sem);
116 * Handling of filesystem drivers list.
122 +static void write_super_lockfs(struct super_block *sb)
125 + if (sb->s_root && sb->s_op) {
126 + if (sb->s_dirt && sb->s_op->write_super)
127 + sb->s_op->write_super(sb);
128 + if (sb->s_op->write_super_lockfs) {
129 + sb->s_op->write_super_lockfs(sb);
135 static inline void write_super(struct super_block *sb)
139 spin_unlock(&sb_lock);
143 + * Note: don't check the dirty flag before waiting, we want the lock
144 + * to happen every time this is called. dev must be non-zero
146 +void sync_supers_lockfs(kdev_t dev)
148 + struct super_block * sb;
150 + down(&lockfs_sem) ;
152 + sb = get_super(dev);
154 + write_super_lockfs(sb);
160 +void unlockfs(kdev_t dev)
162 + struct super_block * sb;
165 + sb = get_super(dev);
167 + if (sb->s_op && sb->s_op->unlockfs)
168 + sb->s_op->unlockfs(sb) ;
176 * get_super - get the superblock of a device
177 * @dev: device to get the superblock for
187 ((flags ^ old->s_flags) & MS_RDONLY)) {
188 spin_unlock(&sb_lock);
193 if (!grab_super(old))
194 @@ -712,12 +767,14 @@
196 blkdev_put(bdev, BDEV_FS);
204 insert_super(s, fs_type);
206 if (!fs_type->read_super(s, data, flags & MS_VERBOSE ? 1 : 0))
208 s->s_flags |= MS_ACTIVE;
210 if (!deactivate_super(sb))
214 down_write(&sb->s_umount);
218 /* Need to clean after the sucker */
219 if (fs->fs_flags & FS_LITTER)
220 diff -Nru a/include/linux/fs.h b/include/linux/fs.h
221 --- a/include/linux/fs.h Wed May 22 10:43:49 2002
222 +++ b/include/linux/fs.h Wed May 22 10:43:49 2002
223 @@ -1218,6 +1218,7 @@
224 extern int sync_buffers(kdev_t, int);
225 extern void sync_dev(kdev_t);
226 extern int fsync_dev(kdev_t);
227 +extern int fsync_dev_lockfs(kdev_t);
228 extern int fsync_super(struct super_block *);
229 extern int fsync_no_super(kdev_t);
230 extern void sync_inodes_sb(struct super_block *);
231 @@ -1234,6 +1235,8 @@
232 extern int filemap_fdatasync(struct address_space *);
233 extern int filemap_fdatawait(struct address_space *);
234 extern void sync_supers(kdev_t);
235 +extern void sync_supers_lockfs(kdev_t);
236 +extern void unlockfs(kdev_t);
237 extern int bmap(struct inode *, int);
238 extern int notify_change(struct dentry *, struct iattr *);
239 extern int permission(struct inode *, int);
240 diff -Nru a/kernel/ksyms.c b/kernel/ksyms.c
241 --- a/kernel/ksyms.c Wed May 22 10:43:49 2002
242 +++ b/kernel/ksyms.c Wed May 22 10:43:49 2002
244 EXPORT_SYMBOL(invalidate_inode_pages);
245 EXPORT_SYMBOL(truncate_inode_pages);
246 EXPORT_SYMBOL(fsync_dev);
247 +EXPORT_SYMBOL(fsync_dev_lockfs);
248 +EXPORT_SYMBOL(unlockfs);
249 EXPORT_SYMBOL(fsync_no_super);
250 EXPORT_SYMBOL(permission);
251 EXPORT_SYMBOL(vfs_permission);