mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
Keep read and write fds with each nlm_file
We shouldn't really be using a read-only file descriptor to take a write lock. Most filesystems will put up with it. But NFS, for example, won't. Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
This commit is contained in:
parent
b661601a9f
commit
7f024fcd5c
7 changed files with 111 additions and 44 deletions
|
@ -10,6 +10,8 @@
|
|||
#ifndef LINUX_LOCKD_LOCKD_H
|
||||
#define LINUX_LOCKD_LOCKD_H
|
||||
|
||||
/* XXX: a lot of this should really be under fs/lockd. */
|
||||
|
||||
#include <linux/in.h>
|
||||
#include <linux/in6.h>
|
||||
#include <net/ipv6.h>
|
||||
|
@ -154,7 +156,8 @@ struct nlm_rqst {
|
|||
struct nlm_file {
|
||||
struct hlist_node f_list; /* linked list */
|
||||
struct nfs_fh f_handle; /* NFS file handle */
|
||||
struct file * f_file; /* VFS file pointer */
|
||||
struct file * f_file[2]; /* VFS file pointers,
|
||||
indexed by O_ flags */
|
||||
struct nlm_share * f_shares; /* DOS shares */
|
||||
struct list_head f_blocks; /* blocked locks */
|
||||
unsigned int f_locks; /* guesstimate # of locks */
|
||||
|
@ -267,6 +270,7 @@ typedef int (*nlm_host_match_fn_t)(void *cur, struct nlm_host *ref);
|
|||
/*
|
||||
* Server-side lock handling
|
||||
*/
|
||||
int lock_to_openmode(struct file_lock *);
|
||||
__be32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *,
|
||||
struct nlm_host *, struct nlm_lock *, int,
|
||||
struct nlm_cookie *, int);
|
||||
|
@ -301,7 +305,8 @@ int nlmsvc_unlock_all_by_ip(struct sockaddr *server_addr);
|
|||
|
||||
static inline struct inode *nlmsvc_file_inode(struct nlm_file *file)
|
||||
{
|
||||
return locks_inode(file->f_file);
|
||||
return locks_inode(file->f_file[O_RDONLY] ?
|
||||
file->f_file[O_RDONLY] : file->f_file[O_WRONLY]);
|
||||
}
|
||||
|
||||
static inline int __nlm_privileged_request4(const struct sockaddr *sap)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue