Catch filesystems lacking s_bdi

Previous thread: bridge br_multicast: Ensure to initialize BR_INPUT_SKB_CB(skb)->mrouters_only. by Linux Kernel Mailing List on Wednesday, April 28, 2010 - 1:59 pm. (1 message)

Next thread: ncpfs: add bdi backing to mount session by Linux Kernel Mailing List on Wednesday, April 28, 2010 - 1:59 pm. (1 message)
From: Linux Kernel Mailing List
Date: Wednesday, April 28, 2010 - 1:59 pm

Gitweb:     http://git.kernel.org/linus/5129a469a91a91427334c40e29e64c6d0ab68caf
Commit:     5129a469a91a91427334c40e29e64c6d0ab68caf
Parent:     7e2455c1a123ceadbb35150a610d61e8443fd340
Author:     Jörn Engel <joern@logfs.org>
AuthorDate: Sun Apr 25 08:54:42 2010 +0200
Committer:  Jens Axboe <jens.axboe@oracle.com>
CommitDate: Sun Apr 25 08:54:42 2010 +0200

    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>
---
 fs/super.c                  |    8 +++++---
 fs/sync.c                   |    3 ++-
 include/linux/backing-dev.h |    1 +
 mm/backing-dev.c            |    5 +++++
 4 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/fs/super.c b/fs/super.c
index f35ac60..dc72491 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -693,6 +693,7 @@ int set_anon_super(struct super_block *s, void *data)
 		return -EMFILE;
 	}
 	s->s_dev = MKDEV(0, dev & MINORMASK);
+	s->s_bdi = &noop_backing_dev_info;
 	return 0;
 }
 
@@ -954,10 +955,11 @@ vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void
 	if (error < 0)
 		goto out_free_secdata;
 	BUG_ON(!mnt->mnt_sb);
+	WARN_ON(!mnt->mnt_sb->s_bdi);
 
- 	error = security_sb_kern_mount(mnt->mnt_sb, flags, secdata);
- 	if (error)
- 		goto out_sb;
+	error = security_sb_kern_mount(mnt->mnt_sb, flags, secdata);
+	if (error)
+		goto out_sb;
 
 	/*
 	 * filesystems should never set s_maxbytes larger than MAX_LFS_FILESIZE
diff --git a/fs/sync.c b/fs/sync.c
index fc5c3d7..92b2281 100644
--- ...
Previous thread: bridge br_multicast: Ensure to initialize BR_INPUT_SKB_CB(skb)->mrouters_only. by Linux Kernel Mailing List on Wednesday, April 28, 2010 - 1:59 pm. (1 message)

Next thread: ncpfs: add bdi backing to mount session by Linux Kernel Mailing List on Wednesday, April 28, 2010 - 1:59 pm. (1 message)