1 diff -urNp linux-1253/fs/buffer.c linux-1255/fs/buffer.c
2 --- linux-1253/fs/buffer.c
3 +++ linux-1255/fs/buffer.c
4 @@ -366,6 +366,34 @@ void sync_dev(kdev_t dev)
8 +int fsync_dev_lockfs(kdev_t dev)
10 + /* you are not allowed to try locking all the filesystems
11 + ** on the system, your chances of getting through without
12 + ** total deadlock are slim to none.
15 + return fsync_dev(dev) ;
17 + sync_buffers(dev, 0);
20 + /* note, the FS might need to start transactions to
21 + ** sync the inodes, or the quota, no locking until
22 + ** after these are done
25 + DQUOT_SYNC_DEV(dev);
26 + /* if inodes or quotas could be dirtied during the
27 + ** sync_supers_lockfs call, the FS is responsible for getting
28 + ** them on disk, without deadlocking against the lock
30 + sync_supers_lockfs(dev) ;
33 + return sync_buffers(dev, 1) ;
36 asmlinkage long sys_sync(void)
39 diff -urNp linux-1253/fs/reiserfs/super.c linux-1255/fs/reiserfs/super.c
40 --- linux-1253/fs/reiserfs/super.c
41 +++ linux-1255/fs/reiserfs/super.c
42 @@ -44,7 +44,7 @@ static void reiserfs_write_super_lockfs
43 reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), 1);
44 journal_mark_dirty(&th, s, SB_BUFFER_WITH_SB (s));
45 reiserfs_block_writes(&th) ;
46 - journal_end(&th, s, 1) ;
47 + journal_end_sync(&th, s, 1) ;
51 diff -urNp linux-1253/fs/super.c linux-1255/fs/super.c
52 --- linux-1253/fs/super.c
53 +++ linux-1255/fs/super.c
55 LIST_HEAD(super_blocks);
56 spinlock_t sb_lock = SPIN_LOCK_UNLOCKED;
59 + * lock/unlockfs grab a read lock on s_umount, but you need this lock to
60 + * make sure no lockfs runs are in progress before inserting/removing
61 + * supers from the list.
63 +static DECLARE_MUTEX(lockfs_sem);
66 * Handling of filesystem drivers list.
68 @@ -451,6 +458,19 @@ void drop_super(struct super_block *sb)
72 +static void write_super_lockfs(struct super_block *sb)
75 + if (sb->s_root && sb->s_op) {
76 + if (sb->s_dirt && sb->s_op->write_super)
77 + sb->s_op->write_super(sb);
78 + if (sb->s_op->write_super_lockfs) {
79 + sb->s_op->write_super_lockfs(sb);
85 static inline void write_super(struct super_block *sb)
88 @@ -498,6 +518,39 @@ restart:
89 spin_unlock(&sb_lock);
93 + * Note: don't check the dirty flag before waiting, we want the lock
94 + * to happen every time this is called. dev must be non-zero
96 +void sync_supers_lockfs(kdev_t dev)
98 + struct super_block * sb;
102 + sb = get_super(dev);
104 + write_super_lockfs(sb);
110 +void unlockfs(kdev_t dev)
112 + struct super_block * sb;
115 + sb = get_super(dev);
117 + if (sb->s_op && sb->s_op->unlockfs)
118 + sb->s_op->unlockfs(sb) ;
126 * get_super - get the superblock of a device
127 * @dev: device to get the superblock for
128 @@ -741,6 +794,7 @@ static struct super_block *get_sb_bdev(s
136 @@ -751,11 +805,13 @@ restart:
137 if (old->s_type != fs_type ||
138 ((flags ^ old->s_flags) & MS_RDONLY)) {
139 spin_unlock(&sb_lock);
144 if (!grab_super(old))
148 blkdev_put(bdev, BDEV_FS);
150 @@ -765,6 +821,7 @@ restart:
153 insert_super(s, fs_type);
155 if (!fs_type->read_super(s, data, flags & MS_VERBOSE ? 1 : 0))
157 s->s_flags |= MS_ACTIVE;
158 @@ -872,7 +929,10 @@ void kill_super(struct super_block *sb)
159 if (!deactivate_super(sb))
163 down_write(&sb->s_umount);
167 /* Need to clean after the sucker */
168 if (fs->fs_flags & FS_LITTER)
169 diff -urNp linux-1253/include/linux/fs.h linux-1255/include/linux/fs.h
170 --- linux-1253/include/linux/fs.h
171 +++ linux-1255/include/linux/fs.h
172 @@ -1275,6 +1275,7 @@ extern void write_inode_now(struct inode
173 extern int sync_buffers(kdev_t, int);
174 extern void sync_dev(kdev_t);
175 extern int fsync_dev(kdev_t);
176 +extern int fsync_dev_lockfs(kdev_t);
177 extern int fsync_super(struct super_block *);
178 extern int fsync_no_super(kdev_t);
179 extern void sync_inodes_sb(struct super_block *);
180 @@ -1291,6 +1292,8 @@ extern int inode_has_buffers(struct inod
181 extern int filemap_fdatasync(struct address_space *);
182 extern int filemap_fdatawait(struct address_space *);
183 extern void sync_supers(kdev_t dev, int wait);
184 +extern void sync_supers_lockfs(kdev_t);
185 +extern void unlockfs(kdev_t);
186 extern int bmap(struct inode *, int);
187 extern int notify_change(struct dentry *, struct iattr *);
188 extern int permission(struct inode *, int);
189 diff -urNp linux-1253/kernel/ksyms.c linux-1255/kernel/ksyms.c
190 --- linux-1253/kernel/ksyms.c
191 +++ linux-1255/kernel/ksyms.c
192 @@ -208,6 +208,8 @@ EXPORT_SYMBOL(invalidate_device);
193 EXPORT_SYMBOL(invalidate_inode_pages);
194 EXPORT_SYMBOL(truncate_inode_pages);
195 EXPORT_SYMBOL(fsync_dev);
196 +EXPORT_SYMBOL(fsync_dev_lockfs);
197 +EXPORT_SYMBOL(unlockfs);
198 EXPORT_SYMBOL(fsync_no_super);
199 EXPORT_SYMBOL(permission);
200 EXPORT_SYMBOL(vfs_permission);