aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJörn Engel <joern@logfs.org>2010-04-25 02:54:42 -0400
committerJens Axboe <jens.axboe@oracle.com>2010-04-25 02:54:42 -0400
commit5129a469a91a91427334c40e29e64c6d0ab68caf (patch)
tree141a17cbea94c7c9c038187cc7081e1c688eac55
parent7e2455c1a123ceadbb35150a610d61e8443fd340 (diff)
Catch filesystems lacking s_bdi
noop_backing_dev_info is used only as a flag to mark filesystems that don't have any backing store, like tmpfs, procfs, spufs, etc. Signed-off-by: Joern Engel <joern@logfs.org> Changed the BUG_ON() to a WARN_ON(). Note that adding dirty inodes to the noop_backing_dev_info is not legal and will not result in them being flushed, but we already catch this condition in __mark_inode_dirty() when checking for a registered bdi. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-rw-r--r--fs/super.c8
-rw-r--r--fs/sync.c3
-rw-r--r--include/linux/backing-dev.h1
-rw-r--r--mm/backing-dev.c5
4 files changed, 13 insertions, 4 deletions
diff --git a/fs/super.c b/fs/super.c
index f35ac6022109..dc72491a19f9 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -693,6 +693,7 @@ int set_anon_super(struct super_block *s, void *data)
693 return -EMFILE; 693 return -EMFILE;
694 } 694 }
695 s->s_dev = MKDEV(0, dev & MINORMASK); 695 s->s_dev = MKDEV(0, dev & MINORMASK);
696 s->s_bdi = &noop_backing_dev_info;
696 return 0; 697 return 0;
697} 698}
698 699
@@ -954,10 +955,11 @@ vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void
954 if (error < 0) 955 if (error < 0)
955 goto out_free_secdata; 956 goto out_free_secdata;
956 BUG_ON(!mnt->mnt_sb); 957 BUG_ON(!mnt->mnt_sb);
958 WARN_ON(!mnt->mnt_sb->s_bdi);
957 959
958 error = security_sb_kern_mount(mnt->mnt_sb, flags, secdata); 960 error = security_sb_kern_mount(mnt->mnt_sb, flags, secdata);
959 if (error) 961 if (error)
960 goto out_sb; 962 goto out_sb;
961 963
962 /* 964 /*
963 * filesystems should never set s_maxbytes larger than MAX_LFS_FILESIZE 965 * filesystems should never set s_maxbytes larger than MAX_LFS_FILESIZE
diff --git a/fs/sync.c b/fs/sync.c
index fc5c3d75cf3c..92b228176f7c 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -14,6 +14,7 @@
14#include <linux/pagemap.h> 14#include <linux/pagemap.h>
15#include <linux/quotaops.h> 15#include <linux/quotaops.h>
16#include <linux/buffer_head.h> 16#include <linux/buffer_head.h>
17#include <linux/backing-dev.h>
17#include "internal.h" 18#include "internal.h"
18 19
19#define VALID_FLAGS (SYNC_FILE_RANGE_WAIT_BEFORE|SYNC_FILE_RANGE_WRITE| \ 20#define VALID_FLAGS (SYNC_FILE_RANGE_WAIT_BEFORE|SYNC_FILE_RANGE_WRITE| \
@@ -32,7 +33,7 @@ static int __sync_filesystem(struct super_block *sb, int wait)
32 * This should be safe, as we require bdi backing to actually 33 * This should be safe, as we require bdi backing to actually
33 * write out data in the first place 34 * write out data in the first place
34 */ 35 */
35 if (!sb->s_bdi) 36 if (!sb->s_bdi || sb->s_bdi == &noop_backing_dev_info)
36 return 0; 37 return 0;
37 38
38 if (sb->s_qcop && sb->s_qcop->quota_sync) 39 if (sb->s_qcop && sb->s_qcop->quota_sync)
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index e19c677f219c..bd0e3c6f323f 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -247,6 +247,7 @@ int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio);
247#endif 247#endif
248 248
249extern struct backing_dev_info default_backing_dev_info; 249extern struct backing_dev_info default_backing_dev_info;
250extern struct backing_dev_info noop_backing_dev_info;
250void default_unplug_io_fn(struct backing_dev_info *bdi, struct page *page); 251void default_unplug_io_fn(struct backing_dev_info *bdi, struct page *page);
251 252
252int writeback_in_progress(struct backing_dev_info *bdi); 253int writeback_in_progress(struct backing_dev_info *bdi);
diff --git a/mm/backing-dev.c b/mm/backing-dev.c
index dbda4707f593..707d0dc6da0f 100644
--- a/mm/backing-dev.c
+++ b/mm/backing-dev.c
@@ -27,6 +27,11 @@ struct backing_dev_info default_backing_dev_info = {
27}; 27};
28EXPORT_SYMBOL_GPL(default_backing_dev_info); 28EXPORT_SYMBOL_GPL(default_backing_dev_info);
29 29
30struct backing_dev_info noop_backing_dev_info = {
31 .name = "noop",
32};
33EXPORT_SYMBOL_GPL(noop_backing_dev_info);
34
30static struct class *bdi_class; 35static struct class *bdi_class;
31 36
32/* 37/*