mirror of
https://github.com/samba-team/samba.git
synced 2025-08-26 01:49:31 +03:00
s3-vfs: Fix stream_depot vfs module on btrfs.
Checking if the directory is empty using 'nlink == 2' only checks if there are no subdirectories. It doesn't indicate if there are files in the directory. However checking link count for no subdirectories is wrong and applications shouldn't rely on it, see: https://lkml.org/lkml/2012/2/1/756 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org>
This commit is contained in:
committed by
David Disseldorp
parent
2405e7906c
commit
654b784e9c
@ -646,7 +646,8 @@ static int streams_depot_unlink(vfs_handle_struct *handle,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (smb_fname_base->st.st_ex_nlink == 1) {
|
||||
ret = SMB_VFS_NEXT_UNLINK(handle, smb_fname);
|
||||
if (ret == 0) {
|
||||
char *dirname = stream_dir(handle, smb_fname_base,
|
||||
&smb_fname_base->st, false);
|
||||
|
||||
@ -656,8 +657,6 @@ static int streams_depot_unlink(vfs_handle_struct *handle,
|
||||
TALLOC_FREE(dirname);
|
||||
}
|
||||
|
||||
ret = SMB_VFS_NEXT_UNLINK(handle, smb_fname);
|
||||
|
||||
TALLOC_FREE(smb_fname_base);
|
||||
return ret;
|
||||
}
|
||||
@ -690,7 +689,8 @@ static int streams_depot_rmdir(vfs_handle_struct *handle, const char *path)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (smb_fname_base->st.st_ex_nlink == 2) {
|
||||
ret = SMB_VFS_NEXT_RMDIR(handle, path);
|
||||
if (ret == 0) {
|
||||
char *dirname = stream_dir(handle, smb_fname_base,
|
||||
&smb_fname_base->st, false);
|
||||
|
||||
@ -700,8 +700,6 @@ static int streams_depot_rmdir(vfs_handle_struct *handle, const char *path)
|
||||
TALLOC_FREE(dirname);
|
||||
}
|
||||
|
||||
ret = SMB_VFS_NEXT_RMDIR(handle, path);
|
||||
|
||||
TALLOC_FREE(smb_fname_base);
|
||||
return ret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user