Re: [PATCH] smb/server: check destination is open when renaming

ChenXiaoSong <[email protected]>
Newsgroups org.kernel.vger.linux-cifs
Message-ID <[email protected]>
Hi Ralph,

I am puzzled by Samba's implementation. When mounted with `posix` 
option, why does `rename_internals_fsp()` still check `found_open = 
files_forall()` (Link[1])? Based on your description, should it only 
check non-POSIX opens?

```
// samba.git
// source3/smbd/smb2_reply.c

1344 NTSTATUS rename_internals_fsp()
1352 {
...
1504                 found_open = files_forall(conn->sconn,
1505                                           rename_check_open_fn,
1506                                           &check_state);
1507                 if (found_open != NULL) {
1508                         DBG_NOTICE("Target file open\n");
1509                         status = NT_STATUS_ACCESS_DENIED;
1510                         goto out;
1511                 }
...
```

Link[1]: 
https://git.samba.org/?p=samba.git;a=blob;f=source3/smbd/smb2_reply.c;h=6bdc02c2374ac6b55def452b2b819b85453b0bb1;hb=HEAD#l1504

On 8/4/26 17:05, ChenXiaoSong wrote:
> Hi Ralph,
> 
> Thanks for your sharing.
> 
> This seems to be the rule for determining whether there are any open 
> child files or subdirectories under the old directory of rename operation.
> 
> For checking whether the new file of rename operation is open, there 
> does not seem to be a POSIX-specific rule.
> 
> Please let me know if my understanding is incorrect.
> 
> On 8/4/26 16:44, Ralph Boehme wrote:
>>
>> - allow rename if there are only other POSIX opens
>> - fail the rename if there's one or more non-POSIX opens
>>
> 

-- 
ChenXiaoSong <[email protected]>
Chinese Homepage: https://chenxiaosong.com
English Homepage: https://chenxiaosong.com/en
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.