diff options
Diffstat (limited to 'fs/lockd')
-rw-r--r-- | fs/lockd/clntlock.c | 2 | ||||
-rw-r--r-- | fs/lockd/clntproc.c | 5 | ||||
-rw-r--r-- | fs/lockd/host.c | 29 | ||||
-rw-r--r-- | fs/lockd/svclock.c | 16 | ||||
-rw-r--r-- | fs/lockd/svcsubs.c | 9 |
5 files changed, 29 insertions, 32 deletions
diff --git a/fs/lockd/clntlock.c b/fs/lockd/clntlock.c index 6cd673d34fb9..0796c45d0d4d 100644 --- a/fs/lockd/clntlock.c +++ b/fs/lockd/clntlock.c | |||
@@ -178,7 +178,7 @@ __be32 nlmclnt_grant(const struct sockaddr *addr, const struct nlm_lock *lock) | |||
178 | continue; | 178 | continue; |
179 | if (!rpc_cmp_addr(nlm_addr(block->b_host), addr)) | 179 | if (!rpc_cmp_addr(nlm_addr(block->b_host), addr)) |
180 | continue; | 180 | continue; |
181 | if (nfs_compare_fh(NFS_FH(fl_blocked->fl_file->f_path.dentry->d_inode) ,fh) != 0) | 181 | if (nfs_compare_fh(NFS_FH(file_inode(fl_blocked->fl_file)) ,fh) != 0) |
182 | continue; | 182 | continue; |
183 | /* Alright, we found a lock. Set the return status | 183 | /* Alright, we found a lock. Set the return status |
184 | * and wake up the caller | 184 | * and wake up the caller |
diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c index b43114c4332a..7e529c3c45c0 100644 --- a/fs/lockd/clntproc.c +++ b/fs/lockd/clntproc.c | |||
@@ -127,7 +127,7 @@ static void nlmclnt_setlockargs(struct nlm_rqst *req, struct file_lock *fl) | |||
127 | struct nlm_lock *lock = &argp->lock; | 127 | struct nlm_lock *lock = &argp->lock; |
128 | 128 | ||
129 | nlmclnt_next_cookie(&argp->cookie); | 129 | nlmclnt_next_cookie(&argp->cookie); |
130 | memcpy(&lock->fh, NFS_FH(fl->fl_file->f_path.dentry->d_inode), sizeof(struct nfs_fh)); | 130 | memcpy(&lock->fh, NFS_FH(file_inode(fl->fl_file)), sizeof(struct nfs_fh)); |
131 | lock->caller = utsname()->nodename; | 131 | lock->caller = utsname()->nodename; |
132 | lock->oh.data = req->a_owner; | 132 | lock->oh.data = req->a_owner; |
133 | lock->oh.len = snprintf(req->a_owner, sizeof(req->a_owner), "%u@%s", | 133 | lock->oh.len = snprintf(req->a_owner, sizeof(req->a_owner), "%u@%s", |
@@ -550,6 +550,9 @@ again: | |||
550 | status = nlmclnt_block(block, req, NLMCLNT_POLL_TIMEOUT); | 550 | status = nlmclnt_block(block, req, NLMCLNT_POLL_TIMEOUT); |
551 | if (status < 0) | 551 | if (status < 0) |
552 | break; | 552 | break; |
553 | /* Resend the blocking lock request after a server reboot */ | ||
554 | if (resp->status == nlm_lck_denied_grace_period) | ||
555 | continue; | ||
553 | if (resp->status != nlm_lck_blocked) | 556 | if (resp->status != nlm_lck_blocked) |
554 | break; | 557 | break; |
555 | } | 558 | } |
diff --git a/fs/lockd/host.c b/fs/lockd/host.c index 764c4d2ed804..969d589c848d 100644 --- a/fs/lockd/host.c +++ b/fs/lockd/host.c | |||
@@ -33,15 +33,15 @@ | |||
33 | static struct hlist_head nlm_server_hosts[NLM_HOST_NRHASH]; | 33 | static struct hlist_head nlm_server_hosts[NLM_HOST_NRHASH]; |
34 | static struct hlist_head nlm_client_hosts[NLM_HOST_NRHASH]; | 34 | static struct hlist_head nlm_client_hosts[NLM_HOST_NRHASH]; |
35 | 35 | ||
36 | #define for_each_host(host, pos, chain, table) \ | 36 | #define for_each_host(host, chain, table) \ |
37 | for ((chain) = (table); \ | 37 | for ((chain) = (table); \ |
38 | (chain) < (table) + NLM_HOST_NRHASH; ++(chain)) \ | 38 | (chain) < (table) + NLM_HOST_NRHASH; ++(chain)) \ |
39 | hlist_for_each_entry((host), (pos), (chain), h_hash) | 39 | hlist_for_each_entry((host), (chain), h_hash) |
40 | 40 | ||
41 | #define for_each_host_safe(host, pos, next, chain, table) \ | 41 | #define for_each_host_safe(host, next, chain, table) \ |
42 | for ((chain) = (table); \ | 42 | for ((chain) = (table); \ |
43 | (chain) < (table) + NLM_HOST_NRHASH; ++(chain)) \ | 43 | (chain) < (table) + NLM_HOST_NRHASH; ++(chain)) \ |
44 | hlist_for_each_entry_safe((host), (pos), (next), \ | 44 | hlist_for_each_entry_safe((host), (next), \ |
45 | (chain), h_hash) | 45 | (chain), h_hash) |
46 | 46 | ||
47 | static unsigned long nrhosts; | 47 | static unsigned long nrhosts; |
@@ -226,7 +226,6 @@ struct nlm_host *nlmclnt_lookup_host(const struct sockaddr *sap, | |||
226 | .net = net, | 226 | .net = net, |
227 | }; | 227 | }; |
228 | struct hlist_head *chain; | 228 | struct hlist_head *chain; |
229 | struct hlist_node *pos; | ||
230 | struct nlm_host *host; | 229 | struct nlm_host *host; |
231 | struct nsm_handle *nsm = NULL; | 230 | struct nsm_handle *nsm = NULL; |
232 | struct lockd_net *ln = net_generic(net, lockd_net_id); | 231 | struct lockd_net *ln = net_generic(net, lockd_net_id); |
@@ -238,7 +237,7 @@ struct nlm_host *nlmclnt_lookup_host(const struct sockaddr *sap, | |||
238 | mutex_lock(&nlm_host_mutex); | 237 | mutex_lock(&nlm_host_mutex); |
239 | 238 | ||
240 | chain = &nlm_client_hosts[nlm_hash_address(sap)]; | 239 | chain = &nlm_client_hosts[nlm_hash_address(sap)]; |
241 | hlist_for_each_entry(host, pos, chain, h_hash) { | 240 | hlist_for_each_entry(host, chain, h_hash) { |
242 | if (host->net != net) | 241 | if (host->net != net) |
243 | continue; | 242 | continue; |
244 | if (!rpc_cmp_addr(nlm_addr(host), sap)) | 243 | if (!rpc_cmp_addr(nlm_addr(host), sap)) |
@@ -323,7 +322,6 @@ struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp, | |||
323 | const size_t hostname_len) | 322 | const size_t hostname_len) |
324 | { | 323 | { |
325 | struct hlist_head *chain; | 324 | struct hlist_head *chain; |
326 | struct hlist_node *pos; | ||
327 | struct nlm_host *host = NULL; | 325 | struct nlm_host *host = NULL; |
328 | struct nsm_handle *nsm = NULL; | 326 | struct nsm_handle *nsm = NULL; |
329 | struct sockaddr *src_sap = svc_daddr(rqstp); | 327 | struct sockaddr *src_sap = svc_daddr(rqstp); |
@@ -351,7 +349,7 @@ struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp, | |||
351 | nlm_gc_hosts(net); | 349 | nlm_gc_hosts(net); |
352 | 350 | ||
353 | chain = &nlm_server_hosts[nlm_hash_address(ni.sap)]; | 351 | chain = &nlm_server_hosts[nlm_hash_address(ni.sap)]; |
354 | hlist_for_each_entry(host, pos, chain, h_hash) { | 352 | hlist_for_each_entry(host, chain, h_hash) { |
355 | if (host->net != net) | 353 | if (host->net != net) |
356 | continue; | 354 | continue; |
357 | if (!rpc_cmp_addr(nlm_addr(host), ni.sap)) | 355 | if (!rpc_cmp_addr(nlm_addr(host), ni.sap)) |
@@ -516,10 +514,9 @@ static struct nlm_host *next_host_state(struct hlist_head *cache, | |||
516 | { | 514 | { |
517 | struct nlm_host *host; | 515 | struct nlm_host *host; |
518 | struct hlist_head *chain; | 516 | struct hlist_head *chain; |
519 | struct hlist_node *pos; | ||
520 | 517 | ||
521 | mutex_lock(&nlm_host_mutex); | 518 | mutex_lock(&nlm_host_mutex); |
522 | for_each_host(host, pos, chain, cache) { | 519 | for_each_host(host, chain, cache) { |
523 | if (host->h_nsmhandle == nsm | 520 | if (host->h_nsmhandle == nsm |
524 | && host->h_nsmstate != info->state) { | 521 | && host->h_nsmstate != info->state) { |
525 | host->h_nsmstate = info->state; | 522 | host->h_nsmstate = info->state; |
@@ -571,7 +568,6 @@ void nlm_host_rebooted(const struct nlm_reboot *info) | |||
571 | static void nlm_complain_hosts(struct net *net) | 568 | static void nlm_complain_hosts(struct net *net) |
572 | { | 569 | { |
573 | struct hlist_head *chain; | 570 | struct hlist_head *chain; |
574 | struct hlist_node *pos; | ||
575 | struct nlm_host *host; | 571 | struct nlm_host *host; |
576 | 572 | ||
577 | if (net) { | 573 | if (net) { |
@@ -588,7 +584,7 @@ static void nlm_complain_hosts(struct net *net) | |||
588 | dprintk("lockd: %lu hosts left:\n", nrhosts); | 584 | dprintk("lockd: %lu hosts left:\n", nrhosts); |
589 | } | 585 | } |
590 | 586 | ||
591 | for_each_host(host, pos, chain, nlm_server_hosts) { | 587 | for_each_host(host, chain, nlm_server_hosts) { |
592 | if (net && host->net != net) | 588 | if (net && host->net != net) |
593 | continue; | 589 | continue; |
594 | dprintk(" %s (cnt %d use %d exp %ld net %p)\n", | 590 | dprintk(" %s (cnt %d use %d exp %ld net %p)\n", |
@@ -601,14 +597,13 @@ void | |||
601 | nlm_shutdown_hosts_net(struct net *net) | 597 | nlm_shutdown_hosts_net(struct net *net) |
602 | { | 598 | { |
603 | struct hlist_head *chain; | 599 | struct hlist_head *chain; |
604 | struct hlist_node *pos; | ||
605 | struct nlm_host *host; | 600 | struct nlm_host *host; |
606 | 601 | ||
607 | mutex_lock(&nlm_host_mutex); | 602 | mutex_lock(&nlm_host_mutex); |
608 | 603 | ||
609 | /* First, make all hosts eligible for gc */ | 604 | /* First, make all hosts eligible for gc */ |
610 | dprintk("lockd: nuking all hosts in net %p...\n", net); | 605 | dprintk("lockd: nuking all hosts in net %p...\n", net); |
611 | for_each_host(host, pos, chain, nlm_server_hosts) { | 606 | for_each_host(host, chain, nlm_server_hosts) { |
612 | if (net && host->net != net) | 607 | if (net && host->net != net) |
613 | continue; | 608 | continue; |
614 | host->h_expires = jiffies - 1; | 609 | host->h_expires = jiffies - 1; |
@@ -645,11 +640,11 @@ static void | |||
645 | nlm_gc_hosts(struct net *net) | 640 | nlm_gc_hosts(struct net *net) |
646 | { | 641 | { |
647 | struct hlist_head *chain; | 642 | struct hlist_head *chain; |
648 | struct hlist_node *pos, *next; | 643 | struct hlist_node *next; |
649 | struct nlm_host *host; | 644 | struct nlm_host *host; |
650 | 645 | ||
651 | dprintk("lockd: host garbage collection for net %p\n", net); | 646 | dprintk("lockd: host garbage collection for net %p\n", net); |
652 | for_each_host(host, pos, chain, nlm_server_hosts) { | 647 | for_each_host(host, chain, nlm_server_hosts) { |
653 | if (net && host->net != net) | 648 | if (net && host->net != net) |
654 | continue; | 649 | continue; |
655 | host->h_inuse = 0; | 650 | host->h_inuse = 0; |
@@ -658,7 +653,7 @@ nlm_gc_hosts(struct net *net) | |||
658 | /* Mark all hosts that hold locks, blocks or shares */ | 653 | /* Mark all hosts that hold locks, blocks or shares */ |
659 | nlmsvc_mark_resources(net); | 654 | nlmsvc_mark_resources(net); |
660 | 655 | ||
661 | for_each_host_safe(host, pos, next, chain, nlm_server_hosts) { | 656 | for_each_host_safe(host, next, chain, nlm_server_hosts) { |
662 | if (net && host->net != net) | 657 | if (net && host->net != net) |
663 | continue; | 658 | continue; |
664 | if (atomic_read(&host->h_count) || host->h_inuse | 659 | if (atomic_read(&host->h_count) || host->h_inuse |
diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c index 8d80c990dffd..e703318c41df 100644 --- a/fs/lockd/svclock.c +++ b/fs/lockd/svclock.c | |||
@@ -406,8 +406,8 @@ nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file, | |||
406 | __be32 ret; | 406 | __be32 ret; |
407 | 407 | ||
408 | dprintk("lockd: nlmsvc_lock(%s/%ld, ty=%d, pi=%d, %Ld-%Ld, bl=%d)\n", | 408 | dprintk("lockd: nlmsvc_lock(%s/%ld, ty=%d, pi=%d, %Ld-%Ld, bl=%d)\n", |
409 | file->f_file->f_path.dentry->d_inode->i_sb->s_id, | 409 | file_inode(file->f_file)->i_sb->s_id, |
410 | file->f_file->f_path.dentry->d_inode->i_ino, | 410 | file_inode(file->f_file)->i_ino, |
411 | lock->fl.fl_type, lock->fl.fl_pid, | 411 | lock->fl.fl_type, lock->fl.fl_pid, |
412 | (long long)lock->fl.fl_start, | 412 | (long long)lock->fl.fl_start, |
413 | (long long)lock->fl.fl_end, | 413 | (long long)lock->fl.fl_end, |
@@ -513,8 +513,8 @@ nlmsvc_testlock(struct svc_rqst *rqstp, struct nlm_file *file, | |||
513 | __be32 ret; | 513 | __be32 ret; |
514 | 514 | ||
515 | dprintk("lockd: nlmsvc_testlock(%s/%ld, ty=%d, %Ld-%Ld)\n", | 515 | dprintk("lockd: nlmsvc_testlock(%s/%ld, ty=%d, %Ld-%Ld)\n", |
516 | file->f_file->f_path.dentry->d_inode->i_sb->s_id, | 516 | file_inode(file->f_file)->i_sb->s_id, |
517 | file->f_file->f_path.dentry->d_inode->i_ino, | 517 | file_inode(file->f_file)->i_ino, |
518 | lock->fl.fl_type, | 518 | lock->fl.fl_type, |
519 | (long long)lock->fl.fl_start, | 519 | (long long)lock->fl.fl_start, |
520 | (long long)lock->fl.fl_end); | 520 | (long long)lock->fl.fl_end); |
@@ -606,8 +606,8 @@ nlmsvc_unlock(struct net *net, struct nlm_file *file, struct nlm_lock *lock) | |||
606 | int error; | 606 | int error; |
607 | 607 | ||
608 | dprintk("lockd: nlmsvc_unlock(%s/%ld, pi=%d, %Ld-%Ld)\n", | 608 | dprintk("lockd: nlmsvc_unlock(%s/%ld, pi=%d, %Ld-%Ld)\n", |
609 | file->f_file->f_path.dentry->d_inode->i_sb->s_id, | 609 | file_inode(file->f_file)->i_sb->s_id, |
610 | file->f_file->f_path.dentry->d_inode->i_ino, | 610 | file_inode(file->f_file)->i_ino, |
611 | lock->fl.fl_pid, | 611 | lock->fl.fl_pid, |
612 | (long long)lock->fl.fl_start, | 612 | (long long)lock->fl.fl_start, |
613 | (long long)lock->fl.fl_end); | 613 | (long long)lock->fl.fl_end); |
@@ -635,8 +635,8 @@ nlmsvc_cancel_blocked(struct net *net, struct nlm_file *file, struct nlm_lock *l | |||
635 | int status = 0; | 635 | int status = 0; |
636 | 636 | ||
637 | dprintk("lockd: nlmsvc_cancel(%s/%ld, pi=%d, %Ld-%Ld)\n", | 637 | dprintk("lockd: nlmsvc_cancel(%s/%ld, pi=%d, %Ld-%Ld)\n", |
638 | file->f_file->f_path.dentry->d_inode->i_sb->s_id, | 638 | file_inode(file->f_file)->i_sb->s_id, |
639 | file->f_file->f_path.dentry->d_inode->i_ino, | 639 | file_inode(file->f_file)->i_ino, |
640 | lock->fl.fl_pid, | 640 | lock->fl.fl_pid, |
641 | (long long)lock->fl.fl_start, | 641 | (long long)lock->fl.fl_start, |
642 | (long long)lock->fl.fl_end); | 642 | (long long)lock->fl.fl_end); |
diff --git a/fs/lockd/svcsubs.c b/fs/lockd/svcsubs.c index 8064435e8bef..97e87415b145 100644 --- a/fs/lockd/svcsubs.c +++ b/fs/lockd/svcsubs.c | |||
@@ -45,7 +45,7 @@ static inline void nlm_debug_print_fh(char *msg, struct nfs_fh *f) | |||
45 | 45 | ||
46 | static inline void nlm_debug_print_file(char *msg, struct nlm_file *file) | 46 | static inline void nlm_debug_print_file(char *msg, struct nlm_file *file) |
47 | { | 47 | { |
48 | struct inode *inode = file->f_file->f_path.dentry->d_inode; | 48 | struct inode *inode = file_inode(file->f_file); |
49 | 49 | ||
50 | dprintk("lockd: %s %s/%ld\n", | 50 | dprintk("lockd: %s %s/%ld\n", |
51 | msg, inode->i_sb->s_id, inode->i_ino); | 51 | msg, inode->i_sb->s_id, inode->i_ino); |
@@ -84,7 +84,6 @@ __be32 | |||
84 | nlm_lookup_file(struct svc_rqst *rqstp, struct nlm_file **result, | 84 | nlm_lookup_file(struct svc_rqst *rqstp, struct nlm_file **result, |
85 | struct nfs_fh *f) | 85 | struct nfs_fh *f) |
86 | { | 86 | { |
87 | struct hlist_node *pos; | ||
88 | struct nlm_file *file; | 87 | struct nlm_file *file; |
89 | unsigned int hash; | 88 | unsigned int hash; |
90 | __be32 nfserr; | 89 | __be32 nfserr; |
@@ -96,7 +95,7 @@ nlm_lookup_file(struct svc_rqst *rqstp, struct nlm_file **result, | |||
96 | /* Lock file table */ | 95 | /* Lock file table */ |
97 | mutex_lock(&nlm_file_mutex); | 96 | mutex_lock(&nlm_file_mutex); |
98 | 97 | ||
99 | hlist_for_each_entry(file, pos, &nlm_files[hash], f_list) | 98 | hlist_for_each_entry(file, &nlm_files[hash], f_list) |
100 | if (!nfs_compare_fh(&file->f_handle, f)) | 99 | if (!nfs_compare_fh(&file->f_handle, f)) |
101 | goto found; | 100 | goto found; |
102 | 101 | ||
@@ -248,13 +247,13 @@ static int | |||
248 | nlm_traverse_files(void *data, nlm_host_match_fn_t match, | 247 | nlm_traverse_files(void *data, nlm_host_match_fn_t match, |
249 | int (*is_failover_file)(void *data, struct nlm_file *file)) | 248 | int (*is_failover_file)(void *data, struct nlm_file *file)) |
250 | { | 249 | { |
251 | struct hlist_node *pos, *next; | 250 | struct hlist_node *next; |
252 | struct nlm_file *file; | 251 | struct nlm_file *file; |
253 | int i, ret = 0; | 252 | int i, ret = 0; |
254 | 253 | ||
255 | mutex_lock(&nlm_file_mutex); | 254 | mutex_lock(&nlm_file_mutex); |
256 | for (i = 0; i < FILE_NRHASH; i++) { | 255 | for (i = 0; i < FILE_NRHASH; i++) { |
257 | hlist_for_each_entry_safe(file, pos, next, &nlm_files[i], f_list) { | 256 | hlist_for_each_entry_safe(file, next, &nlm_files[i], f_list) { |
258 | if (is_failover_file && !is_failover_file(data, file)) | 257 | if (is_failover_file && !is_failover_file(data, file)) |
259 | continue; | 258 | continue; |
260 | file->f_count++; | 259 | file->f_count++; |