linux-stable/fs/dlm
Alexander Aring dbee1adeb7 dlm: use fl_owner from lockd
This patch is changing the fl_owner value in case of an nfs lock request
to not be the pid of lockd. Instead this patch changes it to be the
owner value that nfs is giving us.

Currently there exists proved problems with this behaviour. One nfsd
server was created to export a gfs2 filesystem mount. Two nfs clients
doing a nfs mount of this export. Those two clients should conflict each
other operating on the same nfs file.

A small test program was written:

int main(int argc, const char *argv[])
{
	struct flock fl = {
		.l_type = F_WRLCK,
		.l_whence = SEEK_SET,
		.l_start = 1L,
		.l_len = 1L,
	};
	int fd;

	fd = open("filename", O_RDWR | O_CREAT, 0700);
	printf("try to lock...\n");
	fcntl(fd, F_SETLKW, &fl);
	printf("locked!\n");
	getc(stdin);

	return 0;
}

Running on both clients at the same time and don't interrupting by
pressing any key. It will show that both clients are able to acquire the
lock which shouldn't be the case. The issue is here that the fl_owner
value is the same and the lock context of both clients should be
separated.

This patch lets lockd define how to deal with lock contexts and chose
hopefully the right fl_owner value. A test after this patch was made and
the locks conflicts each other which should be the case.

Acked-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>
2023-11-16 11:59:19 -06:00
..
ast.c fs: dlm: move dlm_purge_lkb_callbacks to user module 2023-06-14 10:17:33 -05:00
ast.h fs: dlm: move dlm_purge_lkb_callbacks to user module 2023-06-14 10:17:33 -05:00
config.c fs: dlm: create midcomms nodes when configure 2023-08-10 10:33:03 -05:00
config.h fs: dlm: remove deprecated code parts 2023-03-06 15:49:07 -06:00
debug_fs.c fs: dlm: Remove some useless memset() 2023-10-12 15:20:17 -05:00
dir.c fs: dlm: constify receive buffer 2023-08-10 10:33:03 -05:00
dir.h fs: dlm: constify receive buffer 2023-08-10 10:33:03 -05:00
dlm_internal.h fs: dlm: debugfs for queued callbacks 2023-08-10 10:33:03 -05:00
Kconfig fs: dlm: remove deprecated code parts 2023-03-06 15:49:07 -06:00
lock.c fs: dlm: constify receive buffer 2023-08-10 10:33:03 -05:00
lock.h fs: dlm: constify receive buffer 2023-08-10 10:33:03 -05:00
lockspace.c fs: dlm: revert check required context while close 2023-06-14 10:17:33 -05:00
lockspace.h fs: dlm: revert check required context while close 2023-06-14 10:17:33 -05:00
lowcomms.c dlm: use kernel_connect() and kernel_bind() 2023-11-16 11:58:42 -06:00
lowcomms.h fs: dlm: remove socket shutdown handling 2022-11-21 09:45:49 -06:00
lvb_table.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 193 2019-05-30 11:29:21 -07:00
main.c fs: dlm: unregister memory at the very last 2023-06-14 10:17:33 -05:00
Makefile fs: dlm: remove deprecated code parts 2023-03-06 15:49:07 -06:00
member.c fs: dlm: constify receive buffer 2023-08-10 10:33:03 -05:00
member.h fs: dlm: constify receive buffer 2023-08-10 10:33:03 -05:00
memory.c fs: dlm: change dflags to use atomic bits 2023-03-06 15:49:07 -06:00
memory.h fs: dlm: allow different allocation context per _create_message 2022-11-08 12:59:41 -06:00
midcomms.c dlm: fix no ack after final message 2023-10-12 15:20:55 -05:00
midcomms.h fs: dlm: create midcomms nodes when configure 2023-08-10 10:33:03 -05:00
plock.c dlm: use fl_owner from lockd 2023-11-16 11:59:19 -06:00
rcom.c fs: dlm: don't use RCOM_NAMES for version detection 2023-08-10 10:33:03 -05:00
rcom.h fs: dlm: constify receive buffer 2023-08-10 10:33:03 -05:00
recover.c fs: dlm: constify receive buffer 2023-08-10 10:33:03 -05:00
recover.h fs: dlm: constify receive buffer 2023-08-10 10:33:03 -05:00
recoverd.c fs: dlm: get recovery sequence number as parameter 2023-08-10 10:33:03 -05:00
recoverd.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 193 2019-05-30 11:29:21 -07:00
requestqueue.c fs: dlm: constify receive buffer 2023-08-10 10:33:03 -05:00
requestqueue.h fs: dlm: constify receive buffer 2023-08-10 10:33:03 -05:00
user.c fs: dlm: move dlm_purge_lkb_callbacks to user module 2023-06-14 10:17:33 -05:00
user.h fs: dlm: move dlm_purge_lkb_callbacks to user module 2023-06-14 10:17:33 -05:00
util.c dlm: use __le types for dlm messages 2022-04-06 14:02:37 -05:00
util.h dlm: use __le types for dlm messages 2022-04-06 14:02:37 -05:00