[PATCH] s3-vfs: Fix stream_depot vfs module on btrfs.

Andreas Schneider asn at samba.org
Tue Nov 12 05:59:49 MST 2013


On Tuesday 12 November 2013 13:36:28 David Disseldorp wrote:
> Hi Andreas,

Hi,

I sent a second version cause the first was not complete. I've discussed with 
Volker after I sent the patch and then sent a new patch which

a) also does the right thin in the unlink case
b) only tried to remove the server is the deletion of the file was successful.
 
> What was the reason for posting two versions of this change? You
> mentioned that the wrong version was pushed. Should I revert
> 29f12e7d5960906935e3af1405e9759a07d64750 and push this one?

Yes please.


Thanks,


	-- andreas

> 
> Cheers, David
> 
> On Fri,  8 Nov 2013 15:41:18 +0100
> 
> Andreas Schneider <asn at samba.org> wrote:
> > 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 at samba.org>
> > ---
> > 
> >  source3/modules/vfs_streams_depot.c | 10 ++++------
> >  1 file changed, 4 insertions(+), 6 deletions(-)
> > 
> > diff --git a/source3/modules/vfs_streams_depot.c
> > b/source3/modules/vfs_streams_depot.c index 3ada92e..ae1af24 100644
> > --- a/source3/modules/vfs_streams_depot.c
> > +++ b/source3/modules/vfs_streams_depot.c
> > @@ -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;
> >  
> >  }

-- 
Andreas Schneider                   GPG-ID: CC014E3D
Samba Team                             asn at samba.org
www.samba.org



More information about the samba-technical mailing list