History

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.

J. Bruce Fields committed 5 years ago

Commit 7f024fc1 parent b6616017 files · +111 −44Browse files

Showing the changes to include/linux/lockd (2 of 7 files). Show all

Unified · Split

2 files
  1. include/linux/lockd/bind.h +2 −1
  2. include/linux/lockd/lockd.h +7 −2
include/linux/lockd/bind.h+2−1
@@ -27,7 +27,8 @@ struct rpc_task; · 26 unmodified lines
27struct nlmsvc_binding {27struct nlmsvc_binding {
28 __be32 (*fopen)(struct svc_rqst *,28 __be32 (*fopen)(struct svc_rqst *,
29 struct nfs_fh *,29 struct nfs_fh *,
30 struct file **);30 struct file **,
31 int mode);
31 void (*fclose)(struct file *);32 void (*fclose)(struct file *);
32};33};
33 34
include/linux/lockd/lockd.h+7−2
@@ -10,6 +10,8 @@ · 9 unmodified lines
10#ifndef LINUX_LOCKD_LOCKD_H10#ifndef LINUX_LOCKD_LOCKD_H
11#define LINUX_LOCKD_LOCKD_H11#define LINUX_LOCKD_LOCKD_H
12 12
13/* XXX: a lot of this should really be under fs/lockd. */
14
13#include <linux/in.h>15#include <linux/in.h>
14#include <linux/in6.h>16#include <linux/in6.h>
15#include <net/ipv6.h>17#include <net/ipv6.h>
@@ -154,7 +156,8 @@ struct nlm_rqst { · 138 unmodified lines
154struct nlm_file {156struct nlm_file {
155 struct hlist_node f_list; /* linked list */157 struct hlist_node f_list; /* linked list */
156 struct nfs_fh f_handle; /* NFS file handle */158 struct nfs_fh f_handle; /* NFS file handle */
157 struct file * f_file; /* VFS file pointer */159 struct file * f_file[2]; /* VFS file pointers,
160 indexed by O_ flags */
158 struct nlm_share * f_shares; /* DOS shares */161 struct nlm_share * f_shares; /* DOS shares */
159 struct list_head f_blocks; /* blocked locks */162 struct list_head f_blocks; /* blocked locks */
160 unsigned int f_locks; /* guesstimate # of locks */163 unsigned int f_locks; /* guesstimate # of locks */
@@ -267,6 +270,7 @@ typedef int (*nlm_host_match_fn_t)(void *cur, struct nlm_host *ref); · 106 unmodified lines
267/*270/*
268 * Server-side lock handling271 * Server-side lock handling
269 */272 */
273int lock_to_openmode(struct file_lock *);
270__be32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *,274__be32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *,
271 struct nlm_host *, struct nlm_lock *, int,275 struct nlm_host *, struct nlm_lock *, int,
272 struct nlm_cookie *, int);276 struct nlm_cookie *, int);
@@ -301,7 +305,8 @@ int nlmsvc_unlock_all_by_ip(struct sockaddr *server_addr); · 28 unmodified lines
301 305
302static inline struct inode *nlmsvc_file_inode(struct nlm_file *file)306static inline struct inode *nlmsvc_file_inode(struct nlm_file *file)
303{307{
304 return locks_inode(file->f_file);308 return locks_inode(file->f_file[O_RDONLY] ?
309 file->f_file[O_RDONLY] : file->f_file[O_WRONLY]);
305}310}
306 311
307static inline int __nlm_privileged_request4(const struct sockaddr *sap)312static inline int __nlm_privileged_request4(const struct sockaddr *sap)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t