diff options
Diffstat (limited to 'fs/cifs/cifsfs.c')
-rw-r--r-- | fs/cifs/cifsfs.c | 50 |
1 files changed, 30 insertions, 20 deletions
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 78c02eb4cb1f..b7431afdd76d 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -45,8 +45,8 @@ | |||
45 | #include "cifs_fs_sb.h" | 45 | #include "cifs_fs_sb.h" |
46 | #include <linux/mm.h> | 46 | #include <linux/mm.h> |
47 | #include <linux/key-type.h> | 47 | #include <linux/key-type.h> |
48 | #include "dns_resolve.h" | ||
49 | #include "cifs_spnego.h" | 48 | #include "cifs_spnego.h" |
49 | #include "fscache.h" | ||
50 | #define CIFS_MAGIC_NUMBER 0xFF534D42 /* the first four bytes of SMB PDUs */ | 50 | #define CIFS_MAGIC_NUMBER 0xFF534D42 /* the first four bytes of SMB PDUs */ |
51 | 51 | ||
52 | int cifsFYI = 0; | 52 | int cifsFYI = 0; |
@@ -329,6 +329,14 @@ cifs_destroy_inode(struct inode *inode) | |||
329 | } | 329 | } |
330 | 330 | ||
331 | static void | 331 | static void |
332 | cifs_evict_inode(struct inode *inode) | ||
333 | { | ||
334 | truncate_inode_pages(&inode->i_data, 0); | ||
335 | end_writeback(inode); | ||
336 | cifs_fscache_release_inode_cookie(inode); | ||
337 | } | ||
338 | |||
339 | static void | ||
332 | cifs_show_address(struct seq_file *s, struct TCP_Server_Info *server) | 340 | cifs_show_address(struct seq_file *s, struct TCP_Server_Info *server) |
333 | { | 341 | { |
334 | seq_printf(s, ",addr="); | 342 | seq_printf(s, ",addr="); |
@@ -473,14 +481,24 @@ static int cifs_remount(struct super_block *sb, int *flags, char *data) | |||
473 | return 0; | 481 | return 0; |
474 | } | 482 | } |
475 | 483 | ||
484 | static int cifs_drop_inode(struct inode *inode) | ||
485 | { | ||
486 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); | ||
487 | |||
488 | /* no serverino => unconditional eviction */ | ||
489 | return !(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) || | ||
490 | generic_drop_inode(inode); | ||
491 | } | ||
492 | |||
476 | static const struct super_operations cifs_super_ops = { | 493 | static const struct super_operations cifs_super_ops = { |
477 | .put_super = cifs_put_super, | 494 | .put_super = cifs_put_super, |
478 | .statfs = cifs_statfs, | 495 | .statfs = cifs_statfs, |
479 | .alloc_inode = cifs_alloc_inode, | 496 | .alloc_inode = cifs_alloc_inode, |
480 | .destroy_inode = cifs_destroy_inode, | 497 | .destroy_inode = cifs_destroy_inode, |
481 | /* .drop_inode = generic_delete_inode, | 498 | .drop_inode = cifs_drop_inode, |
482 | .delete_inode = cifs_delete_inode, */ /* Do not need above two | 499 | .evict_inode = cifs_evict_inode, |
483 | functions unless later we add lazy close of inodes or unless the | 500 | /* .delete_inode = cifs_delete_inode, */ /* Do not need above |
501 | function unless later we add lazy close of inodes or unless the | ||
484 | kernel forgets to call us with the same number of releases (closes) | 502 | kernel forgets to call us with the same number of releases (closes) |
485 | as opens */ | 503 | as opens */ |
486 | .show_options = cifs_show_options, | 504 | .show_options = cifs_show_options, |
@@ -892,6 +910,10 @@ init_cifs(void) | |||
892 | cFYI(1, "cifs_max_pending set to max of 256"); | 910 | cFYI(1, "cifs_max_pending set to max of 256"); |
893 | } | 911 | } |
894 | 912 | ||
913 | rc = cifs_fscache_register(); | ||
914 | if (rc) | ||
915 | goto out; | ||
916 | |||
895 | rc = cifs_init_inodecache(); | 917 | rc = cifs_init_inodecache(); |
896 | if (rc) | 918 | if (rc) |
897 | goto out_clean_proc; | 919 | goto out_clean_proc; |
@@ -912,27 +934,13 @@ init_cifs(void) | |||
912 | if (rc) | 934 | if (rc) |
913 | goto out_unregister_filesystem; | 935 | goto out_unregister_filesystem; |
914 | #endif | 936 | #endif |
915 | #ifdef CONFIG_CIFS_DFS_UPCALL | ||
916 | rc = register_key_type(&key_type_dns_resolver); | ||
917 | if (rc) | ||
918 | goto out_unregister_key_type; | ||
919 | #endif | ||
920 | rc = slow_work_register_user(THIS_MODULE); | ||
921 | if (rc) | ||
922 | goto out_unregister_resolver_key; | ||
923 | 937 | ||
924 | return 0; | 938 | return 0; |
925 | 939 | ||
926 | out_unregister_resolver_key: | ||
927 | #ifdef CONFIG_CIFS_DFS_UPCALL | ||
928 | unregister_key_type(&key_type_dns_resolver); | ||
929 | out_unregister_key_type: | ||
930 | #endif | ||
931 | #ifdef CONFIG_CIFS_UPCALL | 940 | #ifdef CONFIG_CIFS_UPCALL |
932 | unregister_key_type(&cifs_spnego_key_type); | ||
933 | out_unregister_filesystem: | 941 | out_unregister_filesystem: |
934 | #endif | ||
935 | unregister_filesystem(&cifs_fs_type); | 942 | unregister_filesystem(&cifs_fs_type); |
943 | #endif | ||
936 | out_destroy_request_bufs: | 944 | out_destroy_request_bufs: |
937 | cifs_destroy_request_bufs(); | 945 | cifs_destroy_request_bufs(); |
938 | out_destroy_mids: | 946 | out_destroy_mids: |
@@ -941,6 +949,8 @@ init_cifs(void) | |||
941 | cifs_destroy_inodecache(); | 949 | cifs_destroy_inodecache(); |
942 | out_clean_proc: | 950 | out_clean_proc: |
943 | cifs_proc_clean(); | 951 | cifs_proc_clean(); |
952 | cifs_fscache_unregister(); | ||
953 | out: | ||
944 | return rc; | 954 | return rc; |
945 | } | 955 | } |
946 | 956 | ||
@@ -949,9 +959,9 @@ exit_cifs(void) | |||
949 | { | 959 | { |
950 | cFYI(DBG2, "exit_cifs"); | 960 | cFYI(DBG2, "exit_cifs"); |
951 | cifs_proc_clean(); | 961 | cifs_proc_clean(); |
962 | cifs_fscache_unregister(); | ||
952 | #ifdef CONFIG_CIFS_DFS_UPCALL | 963 | #ifdef CONFIG_CIFS_DFS_UPCALL |
953 | cifs_dfs_release_automount_timer(); | 964 | cifs_dfs_release_automount_timer(); |
954 | unregister_key_type(&key_type_dns_resolver); | ||
955 | #endif | 965 | #endif |
956 | #ifdef CONFIG_CIFS_UPCALL | 966 | #ifdef CONFIG_CIFS_UPCALL |
957 | unregister_key_type(&cifs_spnego_key_type); | 967 | unregister_key_type(&cifs_spnego_key_type); |