Skip to content

Commit d8c8e59

Browse files
committed
Merge tag 'dlm-6.8' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm
Pull dlm updates from David Teigland: "This set cleans up the interface between nfs lockd and dlm, which is handling nfs file locking for gfs2 and ocfs2. Very basic lockd functionality is fixed, in which the fl owner was using the lockd pid instead of the owner value from nfs" * tag 'dlm-6.8' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm: dlm: update format header reflect current format dlm: fix format seq ops type 4 dlm: implement EXPORT_OP_ASYNC_LOCK dlm: use FL_SLEEP to determine blocking vs non-blocking dlm: use fl_owner from lockd dlm: use kernel_connect() and kernel_bind()
2 parents 0c59ae1 + 5beebc1 commit d8c8e59

File tree

5 files changed

+17
-25
lines changed

5 files changed

+17
-25
lines changed

fs/dlm/debug_fs.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -443,14 +443,14 @@ static int table_seq_show(struct seq_file *seq, void *iter_ptr)
443443
break;
444444
case 3:
445445
if (ri->header) {
446-
seq_puts(seq, "version rsb 1.1 lvb 1.1 lkb 1.1\n");
446+
seq_puts(seq, "rsb ptr nodeid first_lkid flags !root_list_empty !recover_list_empty recover_locks_count len\n");
447447
ri->header = 0;
448448
}
449449
print_format3(ri->rsb, seq);
450450
break;
451451
case 4:
452452
if (ri->header) {
453-
seq_puts(seq, "version 4 rsb 2\n");
453+
seq_puts(seq, "rsb ptr nodeid master_nodeid dir_nodeid our_nodeid toss_time flags len str|hex name\n");
454454
ri->header = 0;
455455
}
456456
print_format4(ri->rsb, seq);
@@ -748,7 +748,7 @@ static int table_open4(struct inode *inode, struct file *file)
748748
struct seq_file *seq;
749749
int ret;
750750

751-
ret = seq_open(file, &format5_seq_ops);
751+
ret = seq_open(file, &format4_seq_ops);
752752
if (ret)
753753
return ret;
754754

fs/dlm/lowcomms.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1817,8 +1817,8 @@ static int dlm_tcp_bind(struct socket *sock)
18171817
memcpy(&src_addr, &dlm_local_addr[0], sizeof(src_addr));
18181818
make_sockaddr(&src_addr, 0, &addr_len);
18191819

1820-
result = sock->ops->bind(sock, (struct sockaddr *)&src_addr,
1821-
addr_len);
1820+
result = kernel_bind(sock, (struct sockaddr *)&src_addr,
1821+
addr_len);
18221822
if (result < 0) {
18231823
/* This *may* not indicate a critical error */
18241824
log_print("could not bind for connect: %d", result);
@@ -1830,7 +1830,7 @@ static int dlm_tcp_bind(struct socket *sock)
18301830
static int dlm_tcp_connect(struct connection *con, struct socket *sock,
18311831
struct sockaddr *addr, int addr_len)
18321832
{
1833-
return sock->ops->connect(sock, addr, addr_len, O_NONBLOCK);
1833+
return kernel_connect(sock, addr, addr_len, O_NONBLOCK);
18341834
}
18351835

18361836
static int dlm_tcp_listen_validate(void)
@@ -1862,8 +1862,8 @@ static int dlm_tcp_listen_bind(struct socket *sock)
18621862

18631863
/* Bind to our port */
18641864
make_sockaddr(&dlm_local_addr[0], dlm_config.ci_tcp_port, &addr_len);
1865-
return sock->ops->bind(sock, (struct sockaddr *)&dlm_local_addr[0],
1866-
addr_len);
1865+
return kernel_bind(sock, (struct sockaddr *)&dlm_local_addr[0],
1866+
addr_len);
18671867
}
18681868

18691869
static const struct dlm_proto_ops dlm_tcp_ops = {
@@ -1888,12 +1888,12 @@ static int dlm_sctp_connect(struct connection *con, struct socket *sock,
18881888
int ret;
18891889

18901890
/*
1891-
* Make sock->ops->connect() function return in specified time,
1891+
* Make kernel_connect() function return in specified time,
18921892
* since O_NONBLOCK argument in connect() function does not work here,
18931893
* then, we should restore the default value of this attribute.
18941894
*/
18951895
sock_set_sndtimeo(sock->sk, 5);
1896-
ret = sock->ops->connect(sock, addr, addr_len, 0);
1896+
ret = kernel_connect(sock, addr, addr_len, 0);
18971897
sock_set_sndtimeo(sock->sk, 0);
18981898
return ret;
18991899
}

fs/dlm/plock.c

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,12 @@ int dlm_posix_lock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
140140
op->info.optype = DLM_PLOCK_OP_LOCK;
141141
op->info.pid = fl->fl_pid;
142142
op->info.ex = (fl->fl_type == F_WRLCK);
143-
op->info.wait = IS_SETLKW(cmd);
143+
op->info.wait = !!(fl->fl_flags & FL_SLEEP);
144144
op->info.fsid = ls->ls_global_id;
145145
op->info.number = number;
146146
op->info.start = fl->fl_start;
147147
op->info.end = fl->fl_end;
148+
op->info.owner = (__u64)(long)fl->fl_owner;
148149
/* async handling */
149150
if (fl->fl_lmops && fl->fl_lmops->lm_grant) {
150151
op_data = kzalloc(sizeof(*op_data), GFP_NOFS);
@@ -154,9 +155,6 @@ int dlm_posix_lock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
154155
goto out;
155156
}
156157

157-
/* fl_owner is lockd which doesn't distinguish
158-
processes on the nfs client */
159-
op->info.owner = (__u64) fl->fl_pid;
160158
op_data->callback = fl->fl_lmops->lm_grant;
161159
locks_init_lock(&op_data->flc);
162160
locks_copy_lock(&op_data->flc, fl);
@@ -168,8 +166,6 @@ int dlm_posix_lock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
168166
send_op(op);
169167
rv = FILE_LOCK_DEFERRED;
170168
goto out;
171-
} else {
172-
op->info.owner = (__u64)(long) fl->fl_owner;
173169
}
174170

175171
send_op(op);
@@ -326,10 +322,7 @@ int dlm_posix_unlock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
326322
op->info.number = number;
327323
op->info.start = fl->fl_start;
328324
op->info.end = fl->fl_end;
329-
if (fl->fl_lmops && fl->fl_lmops->lm_grant)
330-
op->info.owner = (__u64) fl->fl_pid;
331-
else
332-
op->info.owner = (__u64)(long) fl->fl_owner;
325+
op->info.owner = (__u64)(long)fl->fl_owner;
333326

334327
if (fl->fl_flags & FL_CLOSE) {
335328
op->info.flags |= DLM_PLOCK_FL_CLOSE;
@@ -389,7 +382,7 @@ int dlm_posix_cancel(dlm_lockspace_t *lockspace, u64 number, struct file *file,
389382
info.number = number;
390383
info.start = fl->fl_start;
391384
info.end = fl->fl_end;
392-
info.owner = (__u64)fl->fl_pid;
385+
info.owner = (__u64)(long)fl->fl_owner;
393386

394387
rv = do_lock_cancel(&info);
395388
switch (rv) {
@@ -450,10 +443,7 @@ int dlm_posix_get(dlm_lockspace_t *lockspace, u64 number, struct file *file,
450443
op->info.number = number;
451444
op->info.start = fl->fl_start;
452445
op->info.end = fl->fl_end;
453-
if (fl->fl_lmops && fl->fl_lmops->lm_grant)
454-
op->info.owner = (__u64) fl->fl_pid;
455-
else
456-
op->info.owner = (__u64)(long) fl->fl_owner;
446+
op->info.owner = (__u64)(long)fl->fl_owner;
457447

458448
send_op(op);
459449
wait_event(recv_wq, (op->done != 0));

fs/gfs2/export.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,5 +190,6 @@ const struct export_operations gfs2_export_ops = {
190190
.fh_to_parent = gfs2_fh_to_parent,
191191
.get_name = gfs2_get_name,
192192
.get_parent = gfs2_get_parent,
193+
.flags = EXPORT_OP_ASYNC_LOCK,
193194
};
194195

fs/ocfs2/export.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,4 +280,5 @@ const struct export_operations ocfs2_export_ops = {
280280
.fh_to_dentry = ocfs2_fh_to_dentry,
281281
.fh_to_parent = ocfs2_fh_to_parent,
282282
.get_parent = ocfs2_get_parent,
283+
.flags = EXPORT_OP_ASYNC_LOCK,
283284
};

0 commit comments

Comments
 (0)