Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Jan 2009 19:45:00 +0100
From:      Attilio Rao <attilio@freebsd.org>
To:        FreeBSD Current <freebsd-current@freebsd.org>, freebsd-fs@freebsd.org
Cc:        bp@freebsd.org, Robert Watson <rwatson@freebsd.org>
Subject:   [PATCH] improving netncp locking
Message-ID:  <3bbf2fe10901281045s7e3280dep5a26df6541595cfe@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
--000e0cd286e283a38b04618f5e64
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

Attached there is a patch that fixes netncp locking.
Actually, netncp tries to drain connections without any protection for
the nc_id field (which is supposed to discriminate between a valid
connection and one under draining).
Also, the drain still uses loose ending LK_DRAIN.
This patch adds correct locking for draining path adding an interlock,
control flags, a refcount and using it accordingly.
Ultimately 2 locks are switched to be sx as they don't rely on any
particular lockmgr feature.

The patch compiles and boots ok, but if someone could test and review
it I would appreciate a lot.

Thanks,
Attilio

-- 
Peace can only be achieved by understanding - A. Einstein

--000e0cd286e283a38b04618f5e64
Content-Type: text/x-diff; charset=US-ASCII; name="netncp.diff"
Content-Disposition: attachment; filename="netncp.diff"
Content-Transfer-Encoding: base64
X-Attachment-Id: f_fqickktn0

LS0tIC91c3Ivc3JjL3N5cy9uZXRuY3AvbmNwX2Nvbm4uYwkyMDA5LTAxLTEwIDEzOjM5OjQ4LjAw
MDAwMDAwMCArMDEwMAorKysgc3lzL25ldG5jcC9uY3BfY29ubi5jCTIwMDktMDEtMjggMTk6MjA6
MDIuMDAwMDAwMDAwICswMTAwCkBAIC0zOCwxMSArMzgsMTMgQEAKICNpbmNsdWRlIDxzeXMvcGFy
YW0uaD4KICNpbmNsdWRlIDxzeXMvc3lzdG0uaD4KICNpbmNsdWRlIDxzeXMva2VybmVsLmg+Cisj
aW5jbHVkZSA8c3lzL2xvY2suaD4KICNpbmNsdWRlIDxzeXMvbWFsbG9jLmg+CisjaW5jbHVkZSA8
c3lzL211dGV4Lmg+Ci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ubl9saXN0KTsgbmNwOyBuY3AgPSBubmNwKSB7
CiAJCQlubmNwID0gU0xJU1RfTkVYVChuY3AsIG5jX25leHQpOwogCQkJaWYgKG5jcF9jb25uX2xv
Y2sobmNwLCB0ZCwgdGQtPnRkX3VjcmVkLApAQCAtOTksNyArOTksNyBAQAogCQkJaWYgKG5jcF9j
b25uX2ZyZWUobmNwKSAhPSAwKQogCQkJCW5jcF9jb25uX3VubG9jayhuY3AsIHRkKTsKIAkJfQot
CQluY3BfY29ubl91bmxvY2tsaXN0KHRkKTsKKwkJbmNwX2Nvbm5feHVubG9ja2xpc3QoKTsKIAl9
CiAJbXR4X3VubG9jaygmR2lhbnQpOwogfQpAQCAtMTM0LDEwICsxMzQsMTAgQEAKIHsKIAlzdHJ1
Y3QgbmNwX2Nvbm4gKmNvbm47CiAKLQlpZihuY3BfY29ubl9sb2NrbGlzdChMS19TSEFSRUQgfCBM
S19OT1dBSVQsIE5VTEwpID09IDApIHsKKwlpZiAobmNwX2Nvbm5fdHJ5X3Nsb2NrbGlzdCgpKSB7
CiAJCVNMSVNUX0ZPUkVBQ0goY29ubiwgJmNvbm5fbGlzdCwgbmNfbmV4dCkKIAkJCW5jcF9jaGVj
a19jb25uKGNvbm4pOwotCQluY3BfY29ubl91bmxvY2tsaXN0KE5VTEwpOworCQluY3BfY29ubl9z
dW5sb2NrbGlzdCgpOwogCX0KIAluY3BfdGltZXJfaGFuZGxlID0gdGltZW91dChuY3BfdGltZXIs
IE5VTEwsIE5DUF9USU1FUl9USUNLKTsKIH0K
--000e0cd286e283a38b04618f5e64--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3bbf2fe10901281045s7e3280dep5a26df6541595cfe>