smbfs: add bdi backing to mount session

This ensures that dirty data gets flushed properly.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
This commit is contained in:
Jens Axboe 2010-04-22 12:37:07 +02:00
parent f1970c73cb
commit 424264b7b2
2 changed files with 11 additions and 0 deletions

View File

@ -479,6 +479,7 @@ smb_put_super(struct super_block *sb)
if (server->conn_pid) if (server->conn_pid)
kill_pid(server->conn_pid, SIGTERM, 1); kill_pid(server->conn_pid, SIGTERM, 1);
bdi_destroy(&server->bdi);
kfree(server->ops); kfree(server->ops);
smb_unload_nls(server); smb_unload_nls(server);
sb->s_fs_info = NULL; sb->s_fs_info = NULL;
@ -525,6 +526,11 @@ static int smb_fill_super(struct super_block *sb, void *raw_data, int silent)
if (!server) if (!server)
goto out_no_server; goto out_no_server;
sb->s_fs_info = server; sb->s_fs_info = server;
if (bdi_setup_and_register(&server->bdi, "smbfs", BDI_CAP_MAP_COPY))
goto out_bdi;
sb->s_bdi = &server->bdi;
server->super_block = sb; server->super_block = sb;
server->mnt = NULL; server->mnt = NULL;
@ -624,6 +630,8 @@ out_no_smbiod:
out_bad_option: out_bad_option:
kfree(mem); kfree(mem);
out_no_mem: out_no_mem:
bdi_destroy(&server->bdi);
out_bdi:
if (!server->mnt) if (!server->mnt)
printk(KERN_ERR "smb_fill_super: allocation failure\n"); printk(KERN_ERR "smb_fill_super: allocation failure\n");
sb->s_fs_info = NULL; sb->s_fs_info = NULL;

View File

@ -10,6 +10,7 @@
#define _SMB_FS_SB #define _SMB_FS_SB
#include <linux/types.h> #include <linux/types.h>
#include <linux/backing-dev.h>
#include <linux/smb.h> #include <linux/smb.h>
/* /*
@ -74,6 +75,8 @@ struct smb_sb_info {
struct smb_ops *ops; struct smb_ops *ops;
struct super_block *super_block; struct super_block *super_block;
struct backing_dev_info bdi;
}; };
static inline int static inline int