Bug 8626 - VFS module to allow delete opened files.
VFS module to allow delete opened files.
Status: RESOLVED WONTFIX
Product: Samba 3.5
Classification: Unclassified
Component: VFS Modules
unspecified
All All
: P5 normal
: ---
Assigned To: Samba Bugzilla Account
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-11-21 19:03 UTC by roma1390@gmail.com
Modified: 2011-12-07 06:50 UTC (History)
0 users

See Also:


Attachments
source3/modules/vfs_open_shared.c (2.10 KB, text/x-csrc)
2011-11-21 19:03 UTC, roma1390@gmail.com
no flags Details
fixed file upload problem. (2.13 KB, text/x-csrc)
2011-12-06 13:25 UTC, roma1390@gmail.com
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description roma1390@gmail.com 2011-11-21 19:03:23 UTC
Created attachment 7131 [details]
source3/modules/vfs_open_shared.c

Problem:

User1: opens file X with Adobe Acrobar Reader (random read only application)
User2: tries delete file X and gets error.

Expected behavior:

User2: successful deletes file X;

Background:

There are a lot of situation where non tech people expects UNIX FS behaviors
from windows shares (delete files/folders opened by others).

Read only user can call NTCreateFile function with flags FILE_SHARE_DELETE and
FILE_SHARE_WRITE... But there is to many broken/unconfigurable programs that
uses default parameters and don't set these flags.

Rationale:

There is a risk to lose data by ignoring program request, but:
1. There was this risk always
2. You must known what You are doing
3. There are situation where no risk will be increased.

Need:

Google show these stats:
304 results for query: samba "file is open in another program"
14900 results for query: samba "The process cannot access the file because it is being used by another process."
http://serverfault.com/questions/118385/how-exactly-do-i-find-the-a-specific-samba-users-process-id-so-that-i-can-kill
and others...

Proposed vfs module:

source3/modules/vfs_open_shared.c

Usage:

Add this parameter to Your share/shares definition
   vfs objects = open_shared

Request:

Please comment this module, improve. You can place it into tree, to help users.
Or just leave it here, maybe some more advanced users will find here and build
by self.
Comment 1 Volker Lendecke 2011-11-25 08:37:36 UTC
Sorry, even as a module this is too dangerous. You should be able to achieve the same with "share modes = no", which itself is a very dangerous and deprecated option.

With best regards,

Volker Lendecke
Comment 2 roma1390@gmail.com 2011-12-06 13:25:44 UTC
Created attachment 7160 [details]
fixed file upload problem.

This updated file fixes file upload problem using file explorer.
By default explorer opens file with O_APPEND, reserver file with
ftruncate(fd, size), and later does pwrite(fd, buf, size, offset=0),
but pwrite ignores offset argument if file is opened with O_APPEND,
so resulting file will be twice larger than normal, fill part of files
filed with zeros.
Comment 3 roma1390@gmail.com 2011-12-06 13:30:23 UTC
(In reply to comment #1)
> Sorry, even as a module this is too dangerous. You should be able to achieve
> the same with "share modes = no", which itself is a very dangerous and
> deprecated option.

How it's dangerous? Ok it's will be no recommended to run two oracle instances
on same share, but otherwise for lite setups it will be nice solution.

Probability to go wrong will be bigger by hard disk or PSU failure.

Event this code is compatible with samba license:

---------
  ....
  THERE IS NO WARRANTY FOR THE PROGRAM, ....
---------
Comment 4 Volker Lendecke 2011-12-07 06:50:49 UTC
(In reply to comment #3)
> (In reply to comment #1)
> > Sorry, even as a module this is too dangerous. You should be able to achieve
> > the same with "share modes = no", which itself is a very dangerous and
> > deprecated option.
> 
> How it's dangerous? Ok it's will be no recommended to run two oracle instances
> on same share, but otherwise for lite setups it will be nice solution.
> 
> Probability to go wrong will be bigger by hard disk or PSU failure.
> 
> Event this code is compatible with samba license:
> 
> ---------
>   ....
>   THERE IS NO WARRANTY FOR THE PROGRAM, ....
> ---------

Sure, no warranties in the legal sense. But we do try our best to adhere to Windows semantics and implement them correctly. Deliberately breaking client applications and creating a big risk of data loss is not an option for us.