[Wine-patches] [eter-1.0.12] eterbug #5798
Alexander Morozov
amorozov на etersoft.ru
Вт Июн 14 21:08:44 MSD 2011
----------- следующая часть -----------
From 6ddf4edec420734569f9898fddd67110bba03e40 Mon Sep 17 00:00:00 2001
From: Alexander Morozov <amorozov на etersoft.ru>
Date: Tue, 14 Jun 2011 17:27:35 +0400
Subject: [eter-1.0.12 1/2] Revert "Close a file descriptor used for locks
when we need to ignore locks (eterbug #7350)."
This reverts commit 73fbc26086a60e2bd2d99335bcf2f3da125dea51.
---
dlls/ntdll/loader.c | 4 ----
server/fd.c | 10 ----------
2 files changed, 0 insertions(+), 14 deletions(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 30cec8d..e0551d6 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -1918,7 +1918,6 @@ static NTSTATUS load_dll( LPCWSTR load_path, LPCWSTR libname, DWORD flags, WINE_
WINE_MODREF *main_exe;
HANDLE handle = 0;
NTSTATUS nts;
- int fd;
TRACE( "looking for %s in %s\n", debugstr_w(libname), debugstr_w(load_path) );
@@ -1943,9 +1942,6 @@ static NTSTATUS load_dll( LPCWSTR load_path, LPCWSTR libname, DWORD flags, WINE_
wine_server_call( req );
}
SERVER_END_REQ;
-
- fd = server_remove_fd_from_cache( handle );
- if (fd != -1) close( fd );
}
if (*pwm) /* found already loaded module */
diff --git a/server/fd.c b/server/fd.c
index 5711620..deb0b02 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -2325,20 +2325,10 @@ DECL_HANDLER(add_fd_completion)
DECL_HANDLER(ignore_locks)
{
struct fd *fd = get_handle_fd_obj( current->process, req->handle, 0 );
- int lock_fd;
if (fd)
{
fd->fs_locks = 0;
- if (fd->inode)
- {
- lock_fd = inode_get_lock_fd( fd->inode );
- if (lock_fd != -1)
- {
- inode_set_lock_fd( fd->inode, -1 );
- close( lock_fd );
- }
- }
release_object( fd );
}
}
--
1.7.4.5
----------- следующая часть -----------
From d59560181c926685c9821afadf0dba2d6b800058 Mon Sep 17 00:00:00 2001
From: Alexander Morozov <amorozov на etersoft.ru>
Date: Tue, 14 Jun 2011 19:18:53 +0400
Subject: [eter-1.0.12 2/2] server: Open file with O_RDWR instead of using
special descriptor (eterbug #5798).
---
server/fd.c | 70 +++++++++++-----------------------------------------------
1 files changed, 14 insertions(+), 56 deletions(-)
diff --git a/server/fd.c b/server/fd.c
index deb0b02..e6849ae 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -289,7 +289,6 @@ struct inode
struct list open; /* list of open file descriptors */
struct list locks; /* list of file locks */
struct list closed; /* list of file descriptors to close at destroy time */
- int lock_fd; /* unix file descriptor for locks */
};
static void inode_dump( struct object *obj, int verbose );
@@ -995,11 +994,6 @@ static void inode_close_pending( struct inode *inode, int keep_unlinks )
}
ptr = next;
}
- if (list_empty( &inode->open ) && inode->lock_fd != -1)
- {
- close( inode->lock_fd );
- inode->lock_fd = -1;
- }
}
static void inode_dump( struct object *obj, int verbose )
@@ -1037,8 +1031,6 @@ static void inode_destroy( struct object *obj )
}
free( fd );
}
- if (inode->lock_fd != -1)
- close( inode->lock_fd );
release_object( inode->device );
}
@@ -1068,7 +1060,6 @@ static struct inode *get_inode( dev_t dev, ino_t ino, int unix_fd )
list_init( &inode->open );
list_init( &inode->locks );
list_init( &inode->closed );
- inode->lock_fd = -1;
list_add_head( &device->inode_hash[hash], &inode->entry );
}
else release_object( device );
@@ -1099,18 +1090,6 @@ static void inode_add_closed_fd( struct inode *inode, struct closed_fd *fd )
}
}
-/* get fd which can be used for locks */
-static int inode_get_lock_fd( struct inode *inode )
-{
- return inode->lock_fd;
-}
-
-/* set fd which can be used for locks */
-static void inode_set_lock_fd( struct inode *inode, int lock_fd )
-{
- inode->lock_fd = lock_fd;
-}
-
/****************************************************************/
/* file lock functions */
@@ -1137,7 +1116,6 @@ static int file_lock_signaled( struct object *obj, struct thread *thread )
static int set_unix_lock( struct fd *fd, file_pos_t start, file_pos_t end, int type )
{
struct flock fl;
- int lock_fd;
if (!fd->fs_locks) return 1; /* no fs locks possible for this fd */
for (;;)
@@ -1168,9 +1146,7 @@ static int set_unix_lock( struct fd *fd, file_pos_t start, file_pos_t end, int t
}
fl.l_type = F_RDLCK;
}
- lock_fd = inode_get_lock_fd( fd->inode );
- if (lock_fd == -1) lock_fd = fd->unix_fd;
- if (fcntl( lock_fd, F_SETLK, &fl ) != -1) return 1;
+ if (fcntl( fd->unix_fd, F_SETLK, &fl ) != -1) return 1;
/* perror("Etersoft warning (some error during lock):"); */
switch(errno)
{
@@ -1621,7 +1597,6 @@ static int check_sharing( struct fd *fd, unsigned int access, unsigned int shari
unsigned int existing_sharing = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE;
unsigned int existing_access = 0;
struct list *ptr;
- int lock_fd;
/* if access mode is 0, sharing mode is ignored */
if (!access) sharing = existing_sharing;
@@ -1638,20 +1613,9 @@ static int check_sharing( struct fd *fd, unsigned int access, unsigned int shari
}
}
/* Etersoft: Set existing modes from special lock region state, get cifs status */
- if (fd->unix_fd != -1)
- {
- if (etersoft_sharing_set_test_fd)
- {
- lock_fd = inode_get_lock_fd( fd->inode );
- if (lock_fd == -1 && (access & FILE_UNIX_READ_ACCESS) &&
- (access & FILE_UNIX_WRITE_ACCESS))
- lock_fd = fd->unix_fd;
- etersoft_sharing_set_test_fd( lock_fd );
- }
- if (etersoft_sharing_pre)
- fd->cifs = etersoft_sharing_pre(fd->unix_fd, fd->access,
- fd->sharing, &existing_access, &existing_sharing);
- }
+ if (fd->unix_fd != -1 && etersoft_sharing_pre)
+ fd->cifs = etersoft_sharing_pre(fd->unix_fd, fd->access, fd->sharing,
+ &existing_access, &existing_sharing);
if ((access & FILE_UNIX_READ_ACCESS) && !(existing_sharing & FILE_SHARE_READ)) return 0;
if ((access & FILE_UNIX_WRITE_ACCESS) && !(existing_sharing & FILE_SHARE_WRITE)) return 0;
@@ -1782,7 +1746,15 @@ struct fd *open_fd( const char *name, int flags, mode_t *mode, unsigned int acce
/* Etersoft: Set existing modes from special lock region state */
if (etersoft_sharing_open)
- fd->unix_fd = etersoft_sharing_open(name, rw_mode | (flags & ~O_TRUNC) | O_NOCTTY, sharing, *mode );
+ {
+ fd->unix_fd = -1;
+ if (!etersoft_check_cifs || !etersoft_check_cifs())
+ fd->unix_fd = etersoft_sharing_open(name, O_RDWR | (flags & ~O_TRUNC) | O_NOCTTY, sharing, *mode );
+ if (fd->unix_fd == -1)
+ fd->unix_fd = etersoft_sharing_open(name, rw_mode | (flags & ~O_TRUNC) | O_NOCTTY, sharing, *mode );
+ else if (etersoft_sharing_set_test_fd)
+ etersoft_sharing_set_test_fd( fd->unix_fd );
+ }
else
fd->unix_fd = open(name, rw_mode | (flags & ~O_TRUNC) | O_NOCTTY, *mode );
/* Can we detect cifs here?
@@ -1810,7 +1782,6 @@ struct fd *open_fd( const char *name, int flags, mode_t *mode, unsigned int acce
if (S_ISREG(st.st_mode) || S_ISDIR(st.st_mode))
{
struct inode *inode = get_inode( st.st_dev, st.st_ino, fd->unix_fd );
- int lock_fd;
if (!inode)
{
@@ -1823,14 +1794,6 @@ struct fd *open_fd( const char *name, int flags, mode_t *mode, unsigned int acce
fd->closed = closed_fd;
list_add_head( &inode->open, &fd->inode_entry );
- if (S_ISREG(st.st_mode) && rw_mode != O_RDWR &&
- inode_get_lock_fd( inode ) == -1 &&
- (!etersoft_check_cifs || !etersoft_check_cifs()))
- {
- lock_fd = open( name, O_RDWR );
- inode_set_lock_fd( inode, lock_fd );
- }
-
/* check directory options */
if ((options & FILE_DIRECTORY_FILE) && !S_ISDIR(st.st_mode))
{
@@ -2221,12 +2184,7 @@ DECL_HANDLER(get_handle_fd)
if ((fd = get_handle_fd_obj( current->process, req->handle, 0 )))
{
- int unix_fd = -1;
-
- if (fd->inode)
- unix_fd = inode_get_lock_fd( fd->inode );
- if (unix_fd == -1)
- unix_fd = get_unix_fd( fd );
+ int unix_fd = get_unix_fd( fd );
if (unix_fd != -1)
{
reply->type = fd->fd_ops->get_fd_type( fd );
--
1.7.4.5
Подробная информация о списке рассылки Wine-patches