cifs: 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:
@@ -18,6 +18,8 @@
|
|||||||
#ifndef _CIFS_FS_SB_H
|
#ifndef _CIFS_FS_SB_H
|
||||||
#define _CIFS_FS_SB_H
|
#define _CIFS_FS_SB_H
|
||||||
|
|
||||||
|
#include <linux/backing-dev.h>
|
||||||
|
|
||||||
#define CIFS_MOUNT_NO_PERM 1 /* do not do client vfs_perm check */
|
#define CIFS_MOUNT_NO_PERM 1 /* do not do client vfs_perm check */
|
||||||
#define CIFS_MOUNT_SET_UID 2 /* set current's euid in create etc. */
|
#define CIFS_MOUNT_SET_UID 2 /* set current's euid in create etc. */
|
||||||
#define CIFS_MOUNT_SERVER_INUM 4 /* inode numbers from uniqueid from server */
|
#define CIFS_MOUNT_SERVER_INUM 4 /* inode numbers from uniqueid from server */
|
||||||
@@ -50,5 +52,6 @@ struct cifs_sb_info {
|
|||||||
#ifdef CONFIG_CIFS_DFS_UPCALL
|
#ifdef CONFIG_CIFS_DFS_UPCALL
|
||||||
char *mountdata; /* mount options received at mount time */
|
char *mountdata; /* mount options received at mount time */
|
||||||
#endif
|
#endif
|
||||||
|
struct backing_dev_info bdi;
|
||||||
};
|
};
|
||||||
#endif /* _CIFS_FS_SB_H */
|
#endif /* _CIFS_FS_SB_H */
|
||||||
|
@@ -103,6 +103,12 @@ cifs_read_super(struct super_block *sb, void *data,
|
|||||||
if (cifs_sb == NULL)
|
if (cifs_sb == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
rc = bdi_setup_and_register(&cifs_sb->bdi, "cifs", BDI_CAP_MAP_COPY);
|
||||||
|
if (rc) {
|
||||||
|
kfree(cifs_sb);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_CIFS_DFS_UPCALL
|
#ifdef CONFIG_CIFS_DFS_UPCALL
|
||||||
/* copy mount params to sb for use in submounts */
|
/* copy mount params to sb for use in submounts */
|
||||||
/* BB: should we move this after the mount so we
|
/* BB: should we move this after the mount so we
|
||||||
@@ -115,6 +121,7 @@ cifs_read_super(struct super_block *sb, void *data,
|
|||||||
int len = strlen(data);
|
int len = strlen(data);
|
||||||
cifs_sb->mountdata = kzalloc(len + 1, GFP_KERNEL);
|
cifs_sb->mountdata = kzalloc(len + 1, GFP_KERNEL);
|
||||||
if (cifs_sb->mountdata == NULL) {
|
if (cifs_sb->mountdata == NULL) {
|
||||||
|
bdi_destroy(&cifs_sb->bdi);
|
||||||
kfree(sb->s_fs_info);
|
kfree(sb->s_fs_info);
|
||||||
sb->s_fs_info = NULL;
|
sb->s_fs_info = NULL;
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
@@ -135,6 +142,7 @@ cifs_read_super(struct super_block *sb, void *data,
|
|||||||
|
|
||||||
sb->s_magic = CIFS_MAGIC_NUMBER;
|
sb->s_magic = CIFS_MAGIC_NUMBER;
|
||||||
sb->s_op = &cifs_super_ops;
|
sb->s_op = &cifs_super_ops;
|
||||||
|
sb->s_bdi = &cifs_sb->bdi;
|
||||||
/* if (cifs_sb->tcon->ses->server->maxBuf > MAX_CIFS_HDR_SIZE + 512)
|
/* if (cifs_sb->tcon->ses->server->maxBuf > MAX_CIFS_HDR_SIZE + 512)
|
||||||
sb->s_blocksize =
|
sb->s_blocksize =
|
||||||
cifs_sb->tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE; */
|
cifs_sb->tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE; */
|
||||||
@@ -183,6 +191,7 @@ out_mount_failed:
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
unload_nls(cifs_sb->local_nls);
|
unload_nls(cifs_sb->local_nls);
|
||||||
|
bdi_destroy(&cifs_sb->bdi);
|
||||||
kfree(cifs_sb);
|
kfree(cifs_sb);
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
@@ -214,6 +223,7 @@ cifs_put_super(struct super_block *sb)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
unload_nls(cifs_sb->local_nls);
|
unload_nls(cifs_sb->local_nls);
|
||||||
|
bdi_destroy(&cifs_sb->bdi);
|
||||||
kfree(cifs_sb);
|
kfree(cifs_sb);
|
||||||
|
|
||||||
unlock_kernel();
|
unlock_kernel();
|
||||||
|
Reference in New Issue
Block a user