Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5129a469 authored by Jörn Engel's avatar Jörn Engel Committed by Jens Axboe
Browse files

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: default avatarJoern 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: default avatarJens Axboe <jens.axboe@oracle.com>
parent 7e2455c1
Loading
Loading
Loading
Loading
+5 −3
Original line number Original line Diff line number Diff line
@@ -693,6 +693,7 @@ int set_anon_super(struct super_block *s, void *data)
		return -EMFILE;
		return -EMFILE;
	}
	}
	s->s_dev = MKDEV(0, dev & MINORMASK);
	s->s_dev = MKDEV(0, dev & MINORMASK);
	s->s_bdi = &noop_backing_dev_info;
	return 0;
	return 0;
}
}


@@ -954,6 +955,7 @@ vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void
	if (error < 0)
	if (error < 0)
		goto out_free_secdata;
		goto out_free_secdata;
	BUG_ON(!mnt->mnt_sb);
	BUG_ON(!mnt->mnt_sb);
	WARN_ON(!mnt->mnt_sb->s_bdi);


	error = security_sb_kern_mount(mnt->mnt_sb, flags, secdata);
	error = security_sb_kern_mount(mnt->mnt_sb, flags, secdata);
	if (error)
	if (error)
+2 −1
Original line number Original line Diff line number Diff line
@@ -14,6 +14,7 @@
#include <linux/pagemap.h>
#include <linux/pagemap.h>
#include <linux/quotaops.h>
#include <linux/quotaops.h>
#include <linux/buffer_head.h>
#include <linux/buffer_head.h>
#include <linux/backing-dev.h>
#include "internal.h"
#include "internal.h"


#define VALID_FLAGS (SYNC_FILE_RANGE_WAIT_BEFORE|SYNC_FILE_RANGE_WRITE| \
#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)
	 * This should be safe, as we require bdi backing to actually
	 * This should be safe, as we require bdi backing to actually
	 * write out data in the first place
	 * write out data in the first place
	 */
	 */
	if (!sb->s_bdi)
	if (!sb->s_bdi || sb->s_bdi == &noop_backing_dev_info)
		return 0;
		return 0;


	if (sb->s_qcop && sb->s_qcop->quota_sync)
	if (sb->s_qcop && sb->s_qcop->quota_sync)
+1 −0
Original line number Original line Diff line number Diff line
@@ -247,6 +247,7 @@ int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio);
#endif
#endif


extern struct backing_dev_info default_backing_dev_info;
extern struct backing_dev_info default_backing_dev_info;
extern struct backing_dev_info noop_backing_dev_info;
void default_unplug_io_fn(struct backing_dev_info *bdi, struct page *page);
void default_unplug_io_fn(struct backing_dev_info *bdi, struct page *page);


int writeback_in_progress(struct backing_dev_info *bdi);
int writeback_in_progress(struct backing_dev_info *bdi);
+5 −0
Original line number Original line Diff line number Diff line
@@ -27,6 +27,11 @@ struct backing_dev_info default_backing_dev_info = {
};
};
EXPORT_SYMBOL_GPL(default_backing_dev_info);
EXPORT_SYMBOL_GPL(default_backing_dev_info);


struct backing_dev_info noop_backing_dev_info = {
	.name		= "noop",
};
EXPORT_SYMBOL_GPL(noop_backing_dev_info);

static struct class *bdi_class;
static struct class *bdi_class;


/*
/*