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

Unified · Split

7 files
  1. fs/lockd/svc4proc.c +3 −1
  2. fs/lockd/svclock.c +19 −6
  3. fs/lockd/svcproc.c +3 −1
  4. fs/lockd/svcsubs.c +71 −31
  5. fs/nfsd/lockd.c +6 −2
  6. include/linux/lockd/bind.h +2 −1
  7. include/linux/lockd/lockd.h +7 −2
fs/lockd/svc4proc.c+3−1
@@ -40,13 +40,15 @@ nlm4svc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp, · 39 unmodified lines
40 40
41 /* Obtain file pointer. Not used by FREE_ALL call. */41 /* Obtain file pointer. Not used by FREE_ALL call. */
42 if (filp != NULL) {42 if (filp != NULL) {
43 int mode = lock_to_openmode(&lock->fl);
44
43 error = nlm_lookup_file(rqstp, &file, lock);45 error = nlm_lookup_file(rqstp, &file, lock);
44 if (error)46 if (error)
45 goto no_locks;47 goto no_locks;
46 *filp = file;48 *filp = file;
47 49
48 /* Set up the missing parts of the file_lock structure */50 /* Set up the missing parts of the file_lock structure */
49 lock->fl.fl_file = file->f_file;51 lock->fl.fl_file = file->f_file[mode];
50 lock->fl.fl_pid = current->tgid;52 lock->fl.fl_pid = current->tgid;
51 lock->fl.fl_lmops = &nlmsvc_lock_operations;53 lock->fl.fl_lmops = &nlmsvc_lock_operations;
52 nlmsvc_locks_init_private(&lock->fl, host, (pid_t)lock->svid);54 nlmsvc_locks_init_private(&lock->fl, host, (pid_t)lock->svid);
fs/lockd/svclock.c+19−6
@@ -471,6 +471,7 @@ nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file, · 470 unmodified lines
471{471{
472 struct nlm_block *block = NULL;472 struct nlm_block *block = NULL;
473 int error;473 int error;
474 int mode;
474 __be32 ret;475 __be32 ret;
475 476
476 dprintk("lockd: nlmsvc_lock(%s/%ld, ty=%d, pi=%d, %Ld-%Ld, bl=%d)\n",477 dprintk("lockd: nlmsvc_lock(%s/%ld, ty=%d, pi=%d, %Ld-%Ld, bl=%d)\n",
@@ -524,7 +525,8 @@ nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file, · 47 unmodified lines
524 525
525 if (!wait)526 if (!wait)
526 lock->fl.fl_flags &= ~FL_SLEEP;527 lock->fl.fl_flags &= ~FL_SLEEP;
527 error = vfs_lock_file(file->f_file, F_SETLK, &lock->fl, NULL);528 mode = lock_to_openmode(&lock->fl);
529 error = vfs_lock_file(file->f_file[mode], F_SETLK, &lock->fl, NULL);
528 lock->fl.fl_flags &= ~FL_SLEEP;530 lock->fl.fl_flags &= ~FL_SLEEP;
529 531
530 dprintk("lockd: vfs_lock_file returned %d\n", error);532 dprintk("lockd: vfs_lock_file returned %d\n", error);
@@ -577,6 +579,7 @@ nlmsvc_testlock(struct svc_rqst *rqstp, struct nlm_file *file, · 46 unmodified lines
577 struct nlm_lock *conflock, struct nlm_cookie *cookie)579 struct nlm_lock *conflock, struct nlm_cookie *cookie)
578{580{
579 int error;581 int error;
582 int mode;
580 __be32 ret;583 __be32 ret;
581 struct nlm_lockowner *test_owner;584 struct nlm_lockowner *test_owner;
582 585
@@ -595,7 +598,8 @@ nlmsvc_testlock(struct svc_rqst *rqstp, struct nlm_file *file, · 12 unmodified lines
595 /* If there's a conflicting lock, remember to clean up the test lock */598 /* If there's a conflicting lock, remember to clean up the test lock */
596 test_owner = (struct nlm_lockowner *)lock->fl.fl_owner;599 test_owner = (struct nlm_lockowner *)lock->fl.fl_owner;
597 600
598 error = vfs_test_lock(file->f_file, &lock->fl);601 mode = lock_to_openmode(&lock->fl);
602 error = vfs_test_lock(file->f_file[mode], &lock->fl);
599 if (error) {603 if (error) {
600 /* We can't currently deal with deferred test requests */604 /* We can't currently deal with deferred test requests */
601 if (error == FILE_LOCK_DEFERRED)605 if (error == FILE_LOCK_DEFERRED)
@@ -641,7 +645,7 @@ out: · 39 unmodified lines
641__be32645__be32
642nlmsvc_unlock(struct net *net, struct nlm_file *file, struct nlm_lock *lock)646nlmsvc_unlock(struct net *net, struct nlm_file *file, struct nlm_lock *lock)
643{647{
644 int error;648 int error = 0;
645 649
646 dprintk("lockd: nlmsvc_unlock(%s/%ld, pi=%d, %Ld-%Ld)\n",650 dprintk("lockd: nlmsvc_unlock(%s/%ld, pi=%d, %Ld-%Ld)\n",
647 nlmsvc_file_inode(file)->i_sb->s_id,651 nlmsvc_file_inode(file)->i_sb->s_id,
@@ -654,7 +658,12 @@ nlmsvc_unlock(struct net *net, struct nlm_file *file, struct nlm_lock *lock) · 6 unmodified lines
654 nlmsvc_cancel_blocked(net, file, lock);658 nlmsvc_cancel_blocked(net, file, lock);
655 659
656 lock->fl.fl_type = F_UNLCK;660 lock->fl.fl_type = F_UNLCK;
657 error = vfs_lock_file(file->f_file, F_SETLK, &lock->fl, NULL);661 if (file->f_file[O_RDONLY])
662 error = vfs_lock_file(file->f_file[O_RDONLY], F_SETLK,
663 &lock->fl, NULL);
664 if (file->f_file[O_WRONLY])
665 error = vfs_lock_file(file->f_file[O_WRONLY], F_SETLK,
666 &lock->fl, NULL);
658 667
659 return (error < 0)? nlm_lck_denied_nolocks : nlm_granted;668 return (error < 0)? nlm_lck_denied_nolocks : nlm_granted;
660}669}
@@ -671,6 +680,7 @@ nlmsvc_cancel_blocked(struct net *net, struct nlm_file *file, struct nlm_lock *l · 10 unmodified lines
671{680{
672 struct nlm_block *block;681 struct nlm_block *block;
673 int status = 0;682 int status = 0;
683 int mode;
674 684
675 dprintk("lockd: nlmsvc_cancel(%s/%ld, pi=%d, %Ld-%Ld)\n",685 dprintk("lockd: nlmsvc_cancel(%s/%ld, pi=%d, %Ld-%Ld)\n",
676 nlmsvc_file_inode(file)->i_sb->s_id,686 nlmsvc_file_inode(file)->i_sb->s_id,
@@ -686,7 +696,8 @@ nlmsvc_cancel_blocked(struct net *net, struct nlm_file *file, struct nlm_lock *l · 9 unmodified lines
686 block = nlmsvc_lookup_block(file, lock);696 block = nlmsvc_lookup_block(file, lock);
687 mutex_unlock(&file->f_mutex);697 mutex_unlock(&file->f_mutex);
688 if (block != NULL) {698 if (block != NULL) {
689 vfs_cancel_lock(block->b_file->f_file,699 mode = lock_to_openmode(&lock->fl);
700 vfs_cancel_lock(block->b_file->f_file[mode],
690 &block->b_call->a_args.lock.fl);701 &block->b_call->a_args.lock.fl);
691 status = nlmsvc_unlink_block(block);702 status = nlmsvc_unlink_block(block);
692 nlmsvc_release_block(block);703 nlmsvc_release_block(block);
@@ -803,6 +814,7 @@ nlmsvc_grant_blocked(struct nlm_block *block) · 110 unmodified lines
803{814{
804 struct nlm_file *file = block->b_file;815 struct nlm_file *file = block->b_file;
805 struct nlm_lock *lock = &block->b_call->a_args.lock;816 struct nlm_lock *lock = &block->b_call->a_args.lock;
817 int mode;
806 int error;818 int error;
807 loff_t fl_start, fl_end;819 loff_t fl_start, fl_end;
808 820
@@ -828,7 +840,8 @@ nlmsvc_grant_blocked(struct nlm_block *block) · 19 unmodified lines
828 lock->fl.fl_flags |= FL_SLEEP;840 lock->fl.fl_flags |= FL_SLEEP;
829 fl_start = lock->fl.fl_start;841 fl_start = lock->fl.fl_start;
830 fl_end = lock->fl.fl_end;842 fl_end = lock->fl.fl_end;
831 error = vfs_lock_file(file->f_file, F_SETLK, &lock->fl, NULL);843 mode = lock_to_openmode(&lock->fl);
844 error = vfs_lock_file(file->f_file[mode], F_SETLK, &lock->fl, NULL);
832 lock->fl.fl_flags &= ~FL_SLEEP;845 lock->fl.fl_flags &= ~FL_SLEEP;
833 lock->fl.fl_start = fl_start;846 lock->fl.fl_start = fl_start;
834 lock->fl.fl_end = fl_end;847 lock->fl.fl_end = fl_end;
fs/lockd/svcproc.c+3−1
@@ -55,6 +55,7 @@ nlmsvc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp, · 54 unmodified lines
55 struct nlm_host *host = NULL;55 struct nlm_host *host = NULL;
56 struct nlm_file *file = NULL;56 struct nlm_file *file = NULL;
57 struct nlm_lock *lock = &argp->lock;57 struct nlm_lock *lock = &argp->lock;
58 int mode;
58 __be32 error = 0;59 __be32 error = 0;
59 60
60 /* nfsd callbacks must have been installed for this procedure */61 /* nfsd callbacks must have been installed for this procedure */
@@ -75,7 +76,8 @@ nlmsvc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp, · 14 unmodified lines
75 *filp = file;76 *filp = file;
76 77
77 /* Set up the missing parts of the file_lock structure */78 /* Set up the missing parts of the file_lock structure */
78 lock->fl.fl_file = file->f_file;79 mode = lock_to_openmode(&lock->fl);
80 lock->fl.fl_file = file->f_file[mode];
79 lock->fl.fl_pid = current->tgid;81 lock->fl.fl_pid = current->tgid;
80 lock->fl.fl_lmops = &nlmsvc_lock_operations;82 lock->fl.fl_lmops = &nlmsvc_lock_operations;
81 nlmsvc_locks_init_private(&lock->fl, host, (pid_t)lock->svid);83 nlmsvc_locks_init_private(&lock->fl, host, (pid_t)lock->svid);
fs/lockd/svcsubs.c+71−31
@@ -71,14 +71,35 @@ static inline unsigned int file_hash(struct nfs_fh *f) · 70 unmodified lines
71 return tmp & (FILE_NRHASH - 1);71 return tmp & (FILE_NRHASH - 1);
72}72}
73 73
74int lock_to_openmode(struct file_lock *lock)
75{
76 return (lock->fl_type == F_WRLCK) ? O_WRONLY : O_RDONLY;
77}
78
79/*
80 * Open the file. Note that if we're reexporting, for example,
81 * this could block the lockd thread for a while.
82 *
83 * We have to make sure we have the right credential to open
84 * the file.
85 */
86static __be32 nlm_do_fopen(struct svc_rqst *rqstp,
87 struct nlm_file *file, int mode)
88{
89 struct file **fp = &file->f_file[mode];
90 __be32 nfserr;
91
92 if (*fp)
93 return 0;
94 nfserr = nlmsvc_ops->fopen(rqstp, &file->f_handle, fp, mode);
95 if (nfserr)
96 dprintk("lockd: open failed (error %d)\n", nfserr);
97 return nfserr;
98}
99
74/*100/*
75 * Lookup file info. If it doesn't exist, create a file info struct101 * Lookup file info. If it doesn't exist, create a file info struct
76 * and open a (VFS) file for the given inode.102 * and open a (VFS) file for the given inode.
77 *
78 * FIXME:
79 * Note that we open the file O_RDONLY even when creating write locks.
80 * This is not quite right, but for now, we assume the client performs
81 * the proper R/W checking.
82 */103 */
83__be32104__be32
84nlm_lookup_file(struct svc_rqst *rqstp, struct nlm_file **result,105nlm_lookup_file(struct svc_rqst *rqstp, struct nlm_file **result,
@@ -87,42 +108,38 @@ nlm_lookup_file(struct svc_rqst *rqstp, struct nlm_file **result, · 2 unmodified lines
87 struct nlm_file *file;108 struct nlm_file *file;
88 unsigned int hash;109 unsigned int hash;
89 __be32 nfserr;110 __be32 nfserr;
111 int mode;
90 112
91 nlm_debug_print_fh("nlm_lookup_file", &lock->fh);113 nlm_debug_print_fh("nlm_lookup_file", &lock->fh);
92 114
93 hash = file_hash(&lock->fh);115 hash = file_hash(&lock->fh);
116 mode = lock_to_openmode(&lock->fl);
94 117
95 /* Lock file table */118 /* Lock file table */
96 mutex_lock(&nlm_file_mutex);119 mutex_lock(&nlm_file_mutex);
97 120
98 hlist_for_each_entry(file, &nlm_files[hash], f_list)121 hlist_for_each_entry(file, &nlm_files[hash], f_list)
99 if (!nfs_compare_fh(&file->f_handle, &lock->fh))122 if (!nfs_compare_fh(&file->f_handle, &lock->fh)) {
123 mutex_lock(&file->f_mutex);
124 nfserr = nlm_do_fopen(rqstp, file, mode);
125 mutex_unlock(&file->f_mutex);
100 goto found;126 goto found;
101 127 }
102 nlm_debug_print_fh("creating file for", &lock->fh);128 nlm_debug_print_fh("creating file for", &lock->fh);
103 129
104 nfserr = nlm_lck_denied_nolocks;130 nfserr = nlm_lck_denied_nolocks;
105 file = kzalloc(sizeof(*file), GFP_KERNEL);131 file = kzalloc(sizeof(*file), GFP_KERNEL);
106 if (!file)132 if (!file)
107 goto out_unlock;133 goto out_free;
108 134
109 memcpy(&file->f_handle, &lock->fh, sizeof(struct nfs_fh));135 memcpy(&file->f_handle, &lock->fh, sizeof(struct nfs_fh));
110 mutex_init(&file->f_mutex);136 mutex_init(&file->f_mutex);
111 INIT_HLIST_NODE(&file->f_list);137 INIT_HLIST_NODE(&file->f_list);
112 INIT_LIST_HEAD(&file->f_blocks);138 INIT_LIST_HEAD(&file->f_blocks);
113 139
114 /*140 nfserr = nlm_do_fopen(rqstp, file, mode);
115 * Open the file. Note that if we're reexporting, for example,141 if (nfserr)
116 * this could block the lockd thread for a while.142 goto out_unlock;
117 *
118 * We have to make sure we have the right credential to open
119 * the file.
120 */
121 nfserr = nlmsvc_ops->fopen(rqstp, &lock->fh, &file->f_file);
122 if (nfserr) {
123 dprintk("lockd: open failed (error %d)\n", nfserr);
124 goto out_free;
125 }
126 143
127 hlist_add_head(&file->f_list, &nlm_files[hash]);144 hlist_add_head(&file->f_list, &nlm_files[hash]);
128 145
@@ -130,7 +147,6 @@ found: · 1 unmodified line
130 dprintk("lockd: found file %p (count %d)\n", file, file->f_count);147 dprintk("lockd: found file %p (count %d)\n", file, file->f_count);
131 *result = file;148 *result = file;
132 file->f_count++;149 file->f_count++;
133 nfserr = 0;
134 150
135out_unlock:151out_unlock:
136 mutex_unlock(&nlm_file_mutex);152 mutex_unlock(&nlm_file_mutex);
@@ -150,13 +166,34 @@ nlm_delete_file(struct nlm_file *file) · 13 unmodified lines
150 nlm_debug_print_file("closing file", file);166 nlm_debug_print_file("closing file", file);
151 if (!hlist_unhashed(&file->f_list)) {167 if (!hlist_unhashed(&file->f_list)) {
152 hlist_del(&file->f_list);168 hlist_del(&file->f_list);
153 nlmsvc_ops->fclose(file->f_file);169 if (file->f_file[O_RDONLY])
170 nlmsvc_ops->fclose(file->f_file[O_RDONLY]);
171 if (file->f_file[O_WRONLY])
172 nlmsvc_ops->fclose(file->f_file[O_WRONLY]);
154 kfree(file);173 kfree(file);
155 } else {174 } else {
156 printk(KERN_WARNING "lockd: attempt to release unknown file!\n");175 printk(KERN_WARNING "lockd: attempt to release unknown file!\n");
157 }176 }
158}177}
159 178
179static int nlm_unlock_files(struct nlm_file *file)
180{
181 struct file_lock lock;
182 struct file *f;
183
184 lock.fl_type = F_UNLCK;
185 lock.fl_start = 0;
186 lock.fl_end = OFFSET_MAX;
187 for (f = file->f_file[0]; f <= file->f_file[1]; f++) {
188 if (f && vfs_lock_file(f, F_SETLK, &lock, NULL) < 0) {
189 pr_warn("lockd: unlock failure in %s:%d\n",
190 __FILE__, __LINE__);
191 return 1;
192 }
193 }
194 return 0;
195}
196
160/*197/*
161 * Loop over all locks on the given file and perform the specified198 * Loop over all locks on the given file and perform the specified
162 * action.199 * action.
@@ -184,17 +221,10 @@ again: · 21 unmodified lines
184 221
185 lockhost = ((struct nlm_lockowner *)fl->fl_owner)->host;222 lockhost = ((struct nlm_lockowner *)fl->fl_owner)->host;
186 if (match(lockhost, host)) {223 if (match(lockhost, host)) {
187 struct file_lock lock = *fl;
188 224
189 spin_unlock(&flctx->flc_lock);225 spin_unlock(&flctx->flc_lock);
190 lock.fl_type = F_UNLCK;226 if (nlm_unlock_files(file))
191 lock.fl_start = 0;
192 lock.fl_end = OFFSET_MAX;
193 if (vfs_lock_file(file->f_file, F_SETLK, &lock, NULL) < 0) {
194 printk("lockd: unlock failure in %s:%d\n",
195 __FILE__, __LINE__);
196 return 1;227 return 1;
197 }
198 goto again;228 goto again;
199 }229 }
200 }230 }
@@ -248,6 +278,15 @@ nlm_file_inuse(struct nlm_file *file) · 47 unmodified lines
248 return 0;278 return 0;
249}279}
250 280
281static void nlm_close_files(struct nlm_file *file)
282{
283 struct file *f;
284
285 for (f = file->f_file[0]; f <= file->f_file[1]; f++)
286 if (f)
287 nlmsvc_ops->fclose(f);
288}
289
251/*290/*
252 * Loop over all files in the file table.291 * Loop over all files in the file table.
253 */292 */
@@ -278,7 +317,7 @@ nlm_traverse_files(void *data, nlm_host_match_fn_t match, · 24 unmodified lines
278 if (list_empty(&file->f_blocks) && !file->f_locks317 if (list_empty(&file->f_blocks) && !file->f_locks
279 && !file->f_shares && !file->f_count) {318 && !file->f_shares && !file->f_count) {
280 hlist_del(&file->f_list);319 hlist_del(&file->f_list);
281 nlmsvc_ops->fclose(file->f_file);320 nlm_close_files(file);
282 kfree(file);321 kfree(file);
283 }322 }
284 }323 }
@@ -412,6 +451,7 @@ nlmsvc_invalidate_all(void) · 127 unmodified lines
412 nlm_traverse_files(NULL, nlmsvc_is_client, NULL);451 nlm_traverse_files(NULL, nlmsvc_is_client, NULL);
413}452}
414 453
454
415static int455static int
416nlmsvc_match_sb(void *datap, struct nlm_file *file)456nlmsvc_match_sb(void *datap, struct nlm_file *file)
417{457{
fs/nfsd/lockd.c+6−2
@@ -25,9 +25,11 @@ · 24 unmodified lines
25 * Note: we hold the dentry use count while the file is open.25 * Note: we hold the dentry use count while the file is open.
26 */26 */
27static __be3227static __be32
28nlm_fopen(struct svc_rqst *rqstp, struct nfs_fh *f, struct file **filp)28nlm_fopen(struct svc_rqst *rqstp, struct nfs_fh *f, struct file **filp,
29 int mode)
29{30{
30 __be32 nfserr;31 __be32 nfserr;
32 int access;
31 struct svc_fh fh;33 struct svc_fh fh;
32 34
33 /* must initialize before using! but maxsize doesn't matter */35 /* must initialize before using! but maxsize doesn't matter */
@@ -36,7 +38,9 @@ nlm_fopen(struct svc_rqst *rqstp, struct nfs_fh *f, struct file **filp) · 2 unmodified lines
36 memcpy((char*)&fh.fh_handle.fh_base, f->data, f->size);38 memcpy((char*)&fh.fh_handle.fh_base, f->data, f->size);
37 fh.fh_export = NULL;39 fh.fh_export = NULL;
38 40
39 nfserr = nfsd_open(rqstp, &fh, S_IFREG, NFSD_MAY_LOCK, filp);41 access = (mode == O_WRONLY) ? NFSD_MAY_WRITE : NFSD_MAY_READ;
42 access |= NFSD_MAY_LOCK;
43 nfserr = nfsd_open(rqstp, &fh, S_IFREG, access, filp);
40 fh_put(&fh);44 fh_put(&fh);
41 /* We return nlm error codes as nlm doesn't know45 /* We return nlm error codes as nlm doesn't know
42 * about nfsd, but nfsd does know about nlm..46 * about nfsd, but nfsd does know about nlm..
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