From nobody Fri Nov 26 10:53:03 2021 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8D0B518B56C5; Fri, 26 Nov 2021 10:53:09 +0000 (UTC) (envelope-from peterj@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4J0s6F1Ycwz4Vph; Fri, 26 Nov 2021 10:53:09 +0000 (UTC) (envelope-from peterj@freebsd.org) Received: from server.rulingia.com (ppp239-208.static.internode.on.net [59.167.239.208]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: peterj) by smtp.freebsd.org (Postfix) with ESMTPSA id 9B1FA254F9; Fri, 26 Nov 2021 10:53:07 +0000 (UTC) (envelope-from peterj@freebsd.org) Date: Fri, 26 Nov 2021 21:53:03 +1100 From: Peter Jeremy To: Konstantin Belousov Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: b19740f4ce7a - main - swap_pager: lock vnode in swapdev_strategy() Message-ID: References: <202111251935.1APJZA1e094731@gitrepo.freebsd.org> List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202111251935.1APJZA1e094731@gitrepo.freebsd.org> X-PGP-Key: http://www.rulingia.com/keys/peter.pgp ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1637923989; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Ypeel5Wd138v2d5FU19Xb8DzIFbQIw/zNjTZZBembfo=; b=KM8STz21htv4qAI48oqjITpdSNW+8LCCJgCDdQtX4r4L/n29tVrwN9wjCmmn+V0IJ5sZCM deUONtcgriuuIeqkcsRzjSQnJdjOZD+wkEwAdCk3xn9FH/OshjgF1YbxUr5ZpeG8mg0onS wYEbyWPH7viZ2OiYlR//CJpayjtSh0d1MyKj3uk7vIgNJjlQt1EI/8cqtogssb5X+c3THW PsgAUhvXM5GyNG5jytrof8cbXj/DAlxQZfoDN8H4coUhNxNtb9fkxZbfOOi2RqAztweBGN zKoZprLrRErke20yK533RpieYG2M49kYSTpUyv7YttmvvqJZkrh1htk8Yz1g+A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1637923989; a=rsa-sha256; cv=none; b=tGGqmnXWLBN0lgquLU5b5QvwNwsZ4P3jDXlvXMWaivhnR98/O0v29mTgWbGK7aVSgr+IjV Dt8ZUFlXbYNLoUSbGbdjMKszWMN/q6qn7RVKjEEO4VTJgL94tQU3xuu9YTCbZzjPqb1bnZ 9u48CMnED5m2/6q7jkKj6v2sb6Jc23Lm5faXHDO/fQ2731FePfEukyKonLGB8TauRogrDm dSSob81xxFBs18VLp+8jOjsyogKzbOmTpUg53w5kOUU3jxn0SbKwPzOdGT+zHkBlHb0QRv sEmTISnjITQP06M6s1333x7CFGAdJtiavfAQCfn+ghlMQ8cjvR9rPe49jeQXYQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N On 2021-Nov-25 19:35:10 +0000, Konstantin Belousov wrote: > swap_pager: lock vnode in swapdev_strategy() > > VOP_STRATEGY() requires locked vnode. Note that we lock the swap vnode > while pages are busy, but this would only cause real LoR if pages belong > to the swap vnode, which must not be the case for correct use. > > Reported and tested by: peterj Thanks for those fixes. Unfortunately, I've bumped into another edge case: The system can panic during shutdown because it tries to swap in data after the network is shutdown. For reasons I haven't tracked down, a "swapoff" can fail even though there should be more than enough RAM. As an example: Stopping cron. Waiting for PIDS: 1024. swapoff: /usr/obj/swapfile: Cannot allocate memory Stopping ntpd. Waiting for PIDS: 1012. Stopping tincd for: vpn Waiting for PIDS: 758. Stopping rtsold. Waiting for PIDS: 351. Stopping devd. Waiting for PIDS: 754. Writing entropy file: . Writing early boot entropy file: . . Terminated Nov 26 03:18:44 rock64 syslogd: exiting on signal 15 Waiting (max 60 seconds) for system process `vnlru' to stop... done Waiting (max 60 seconds) for system process `syncer' to stop... Syncing disks, vnodes remaining... 0 0 0 done Waiting (max 60 seconds) for system thread `bufdaemon' to stop... done Waiting (max 60 seconds) for system thread `bufspacedaemon-0' to stop... done All buffers synced. No strategy for buffer at 0xffff0000c0cd3000 vnode 0xffffa00006475e00: type VBAD usecount 3, writecount 0, refcount 974016 seqc users 1 hold count flags () flags (VIRF_DOOMED|VV_VMSIZEVNLOCK) lock type nfs: SHARED (count 1) swap_pager: I/O error - pagein failed; blkno 184,size 4096, error 45 panic: VOP_STRATEGY failed bp=0xffff0000c0cd3000 vp=0 cpuid = 0 time = 1637857131 KDB: stack backtrace: db_trace_self() at db_trace_self db_trace_self_wrapper() at db_trace_self_wrapper+0x30 vpanic() at vpanic+0x178 panic() at panic+0x44 bufstrategy() at bufstrategy+0x80 swapdev_strategy() at swapdev_strategy+0xcc swap_pager_getpages_locked() at swap_pager_getpages_locked+0x460 swapoff_one() at swapoff_one+0x3dc swapoff_all() at swapoff_all+0x98 bufshutdown() at bufshutdown+0x2ac kern_reboot() at kern_reboot+0x240 sys_reboot() at sys_reboot+0x358 do_el0_sync() at do_el0_sync+0x4a4 handle_el0_sync() at handle_el0_sync+0x90 --- exception, esr 0x56000000 KDB: enter: panic [ thread pid 1 tid 100002 ] Stopped at kdb_enter+0x48: undefined f900c11f db> -- Peter Jeremy