|
26 | 26 | #include <linux/sched/signal.h> |
27 | 27 | #include <linux/wait_bit.h> |
28 | 28 | #include <linux/fiemap.h> |
29 | | - |
30 | 29 | #include <asm/div64.h> |
31 | 30 | #include "cifsfs.h" |
32 | 31 | #include "cifspdu.h" |
|
38 | 37 | #include "cifs_unicode.h" |
39 | 38 | #include "fscache.h" |
40 | 39 | #include "fs_context.h" |
41 | | - |
| 40 | +#include "cifs_ioctl.h" |
42 | 41 |
|
43 | 42 | static void cifs_set_ops(struct inode *inode) |
44 | 43 | { |
@@ -1623,6 +1622,9 @@ int cifs_unlink(struct inode *dir, struct dentry *dentry) |
1623 | 1622 |
|
1624 | 1623 | cifs_dbg(FYI, "cifs_unlink, dir=0x%p, dentry=0x%p\n", dir, dentry); |
1625 | 1624 |
|
| 1625 | + if (unlikely(cifs_forced_shutdown(cifs_sb))) |
| 1626 | + return -EIO; |
| 1627 | + |
1626 | 1628 | tlink = cifs_sb_tlink(cifs_sb); |
1627 | 1629 | if (IS_ERR(tlink)) |
1628 | 1630 | return PTR_ERR(tlink); |
@@ -1876,6 +1878,8 @@ int cifs_mkdir(struct user_namespace *mnt_userns, struct inode *inode, |
1876 | 1878 | mode, inode); |
1877 | 1879 |
|
1878 | 1880 | cifs_sb = CIFS_SB(inode->i_sb); |
| 1881 | + if (unlikely(cifs_forced_shutdown(cifs_sb))) |
| 1882 | + return -EIO; |
1879 | 1883 | tlink = cifs_sb_tlink(cifs_sb); |
1880 | 1884 | if (IS_ERR(tlink)) |
1881 | 1885 | return PTR_ERR(tlink); |
@@ -1958,6 +1962,11 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry) |
1958 | 1962 | } |
1959 | 1963 |
|
1960 | 1964 | cifs_sb = CIFS_SB(inode->i_sb); |
| 1965 | + if (unlikely(cifs_forced_shutdown(cifs_sb))) { |
| 1966 | + rc = -EIO; |
| 1967 | + goto rmdir_exit; |
| 1968 | + } |
| 1969 | + |
1961 | 1970 | tlink = cifs_sb_tlink(cifs_sb); |
1962 | 1971 | if (IS_ERR(tlink)) { |
1963 | 1972 | rc = PTR_ERR(tlink); |
@@ -2092,6 +2101,9 @@ cifs_rename2(struct user_namespace *mnt_userns, struct inode *source_dir, |
2092 | 2101 | return -EINVAL; |
2093 | 2102 |
|
2094 | 2103 | cifs_sb = CIFS_SB(source_dir->i_sb); |
| 2104 | + if (unlikely(cifs_forced_shutdown(cifs_sb))) |
| 2105 | + return -EIO; |
| 2106 | + |
2095 | 2107 | tlink = cifs_sb_tlink(cifs_sb); |
2096 | 2108 | if (IS_ERR(tlink)) |
2097 | 2109 | return PTR_ERR(tlink); |
@@ -2408,6 +2420,9 @@ int cifs_getattr(struct user_namespace *mnt_userns, const struct path *path, |
2408 | 2420 | struct inode *inode = d_inode(dentry); |
2409 | 2421 | int rc; |
2410 | 2422 |
|
| 2423 | + if (unlikely(cifs_forced_shutdown(CIFS_SB(inode->i_sb)))) |
| 2424 | + return -EIO; |
| 2425 | + |
2411 | 2426 | /* |
2412 | 2427 | * We need to be sure that all dirty pages are written and the server |
2413 | 2428 | * has actual ctime, mtime and file length. |
@@ -2480,6 +2495,9 @@ int cifs_fiemap(struct inode *inode, struct fiemap_extent_info *fei, u64 start, |
2480 | 2495 | struct cifsFileInfo *cfile; |
2481 | 2496 | int rc; |
2482 | 2497 |
|
| 2498 | + if (unlikely(cifs_forced_shutdown(cifs_sb))) |
| 2499 | + return -EIO; |
| 2500 | + |
2483 | 2501 | /* |
2484 | 2502 | * We need to be sure that all dirty pages are written as they |
2485 | 2503 | * might fill holes on the server. |
@@ -2966,6 +2984,9 @@ cifs_setattr(struct user_namespace *mnt_userns, struct dentry *direntry, |
2966 | 2984 | struct cifs_tcon *pTcon = cifs_sb_master_tcon(cifs_sb); |
2967 | 2985 | int rc, retries = 0; |
2968 | 2986 |
|
| 2987 | + if (unlikely(cifs_forced_shutdown(cifs_sb))) |
| 2988 | + return -EIO; |
| 2989 | + |
2969 | 2990 | do { |
2970 | 2991 | if (pTcon->unix_ext) |
2971 | 2992 | rc = cifs_setattr_unix(direntry, attrs); |
|
0 commit comments