Commit b95cd1b
smb: client: fix missing timestamp updates after utime(2)
Don't reuse open handle when changing timestamps to prevent the server
from disabling automatic timestamp updates as per MS-FSA 2.1.4.17.
---8<---
import os
import time
filename = '/mnt/foo'
def print_stat(prefix):
st = os.stat(filename)
print(prefix, ': ', time.ctime(st.st_atime), time.ctime(st.st_ctime))
fd = os.open(filename, os.O_CREAT|os.O_TRUNC|os.O_WRONLY, 0o644)
print_stat('old')
os.utime(fd, None)
time.sleep(2)
os.write(fd, b'foo')
os.close(fd)
time.sleep(2)
print_stat('new')
---8<---
Before patch:
$ mount.cifs //srv/share /mnt -o ...
$ python3 run.py
old : Fri Oct 3 14:01:21 2025 Fri Oct 3 14:01:21 2025
new : Fri Oct 3 14:01:21 2025 Fri Oct 3 14:01:21 2025
After patch:
$ mount.cifs //srv/share /mnt -o ...
$ python3 run.py
old : Fri Oct 3 17:03:34 2025 Fri Oct 3 17:03:34 2025
new : Fri Oct 3 17:03:36 2025 Fri Oct 3 17:03:36 2025
Fixes: b6f2a0f ("cifs: for compound requests, use open handle if possible")
Signed-off-by: Paulo Alcantara (Red Hat) <[email protected]>
Cc: Frank Sorenson <[email protected]>
Reviewed-by: David Howells <[email protected]>
Cc: [email protected]
Signed-off-by: Steve French <[email protected]>1 parent 57ce9f7 commit b95cd1b
1 file changed
+12
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1382 | 1382 | | |
1383 | 1383 | | |
1384 | 1384 | | |
1385 | | - | |
| 1385 | + | |
1386 | 1386 | | |
| 1387 | + | |
| 1388 | + | |
1387 | 1389 | | |
1388 | 1390 | | |
1389 | | - | |
1390 | | - | |
1391 | | - | |
1392 | | - | |
1393 | | - | |
1394 | | - | |
1395 | | - | |
1396 | | - | |
| 1391 | + | |
1397 | 1392 | | |
1398 | 1393 | | |
1399 | 1394 | | |
1400 | 1395 | | |
1401 | 1396 | | |
1402 | 1397 | | |
1403 | | - | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
1404 | 1405 | | |
1405 | 1406 | | |
1406 | 1407 | | |
1407 | 1408 | | |
1408 | 1409 | | |
1409 | 1410 | | |
| 1411 | + | |
1410 | 1412 | | |
1411 | 1413 | | |
1412 | 1414 | | |
| |||
0 commit comments