Commit e9e6224
cifs: Fix caching to try to do open O_WRONLY as rdwr on server
When we're engaged in local caching of a cifs filesystem, we cannot perform
caching of a partially written cache granule unless we can read the rest of
the granule. This can result in unexpected access errors being reported to
the user.
Fix this by the following: if a file is opened O_WRONLY locally, but the
mount was given the "-o fsc" flag, try first opening the remote file with
GENERIC_READ|GENERIC_WRITE and if that returns -EACCES, try dropping the
GENERIC_READ and doing the open again. If that last succeeds, invalidate
the cache for that file as for O_DIRECT.
Fixes: 70431bf ("cifs: Support fscache indexing rewrite")
Signed-off-by: David Howells <[email protected]>
cc: Steve French <[email protected]>
cc: Shyam Prasad N <[email protected]>
cc: Rohith Surabattula <[email protected]>
cc: Jeff Layton <[email protected]>
cc: [email protected]
cc: [email protected]
cc: [email protected]
Signed-off-by: Steve French <[email protected]>1 parent 24a9799 commit e9e6224
3 files changed
+59
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
| 192 | + | |
192 | 193 | | |
193 | 194 | | |
194 | 195 | | |
| |||
200 | 201 | | |
201 | 202 | | |
202 | 203 | | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
203 | 208 | | |
204 | 209 | | |
205 | 210 | | |
| |||
276 | 281 | | |
277 | 282 | | |
278 | 283 | | |
| 284 | + | |
| 285 | + | |
279 | 286 | | |
280 | 287 | | |
281 | 288 | | |
| |||
304 | 311 | | |
305 | 312 | | |
306 | 313 | | |
| 314 | + | |
307 | 315 | | |
308 | 316 | | |
309 | 317 | | |
| |||
317 | 325 | | |
318 | 326 | | |
319 | 327 | | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
320 | 333 | | |
321 | 334 | | |
| 335 | + | |
| 336 | + | |
322 | 337 | | |
323 | 338 | | |
324 | 339 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
209 | | - | |
| 209 | + | |
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
214 | | - | |
| 214 | + | |
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
| |||
348 | 348 | | |
349 | 349 | | |
350 | 350 | | |
| 351 | + | |
351 | 352 | | |
352 | 353 | | |
353 | 354 | | |
354 | 355 | | |
355 | | - | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
356 | 361 | | |
357 | 362 | | |
358 | 363 | | |
| |||
389 | 394 | | |
390 | 395 | | |
391 | 396 | | |
| 397 | + | |
392 | 398 | | |
393 | 399 | | |
394 | 400 | | |
| |||
400 | 406 | | |
401 | 407 | | |
402 | 408 | | |
403 | | - | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
404 | 415 | | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
405 | 419 | | |
406 | 420 | | |
407 | 421 | | |
| |||
834 | 848 | | |
835 | 849 | | |
836 | 850 | | |
837 | | - | |
838 | | - | |
839 | | - | |
840 | | - | |
841 | | - | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
842 | 856 | | |
843 | 857 | | |
844 | 858 | | |
| |||
903 | 917 | | |
904 | 918 | | |
905 | 919 | | |
| 920 | + | |
906 | 921 | | |
907 | 922 | | |
908 | 923 | | |
| |||
966 | 981 | | |
967 | 982 | | |
968 | 983 | | |
969 | | - | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
970 | 989 | | |
971 | 990 | | |
972 | 991 | | |
| |||
978 | 997 | | |
979 | 998 | | |
980 | 999 | | |
| 1000 | + | |
981 | 1001 | | |
982 | 1002 | | |
983 | 1003 | | |
| |||
1003 | 1023 | | |
1004 | 1024 | | |
1005 | 1025 | | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
1006 | 1031 | | |
1007 | 1032 | | |
1008 | 1033 | | |
| |||
1011 | 1036 | | |
1012 | 1037 | | |
1013 | 1038 | | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
1014 | 1042 | | |
1015 | 1043 | | |
1016 | 1044 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
112 | 117 | | |
113 | 118 | | |
114 | 119 | | |
| |||
124 | 129 | | |
125 | 130 | | |
126 | 131 | | |
| 132 | + | |
127 | 133 | | |
128 | 134 | | |
129 | 135 | | |
| |||
0 commit comments