Linux CXL
 help / color / mirror / Atom feed
From: Dave Jiang <dave.jiang@intel.com>
To: Vishal Verma <vishal.l.verma@intel.com>,
	nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org
Cc: Dan Williams <dan.j.williams@intel.com>,
	Alison Schofield <alison.schofield@intel.com>,
	Ira Weiny <ira.weiny@intel.com>
Subject: Re: [PATCH ndctl 1/2] daxctl/device.c: Handle special case of destroying daxX.0
Date: Mon, 15 Apr 2024 09:17:08 -0700	[thread overview]
Message-ID: <308450ff-00ad-4884-a62e-22d69a4727db@intel.com> (raw)
In-Reply-To: <20240412-vv-daxctl-fixes-v1-1-6e808174e24f@intel.com>



On 4/12/24 2:05 PM, Vishal Verma wrote:
> The kernel has special handling for destroying the 0th dax device under
> any given DAX region (daxX.0). It ensures the size is set to 0, but
> doesn't actually remove the device, instead it returns an EBUSY,
> indicating that this device cannot be removed.
> 
> Add an expectation in daxctl's dev_destroy() helper to handle this case
> instead of returning the error - as far as the user is concerned, the
> size has been set to zero, and the destroy operation has been completed,
> even if the kernel indicated an EBUSY.
> 
> Cc: Dan Williams <dan.j.williams@intel.com>
> Cc: Alison Schofield <alison.schofield@intel.com>
> Reported-by: Ira Weiny <ira.weiny@intel.com>
> Reported-by: Dave Jiang <dave.jiang@intel.com>
> Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>

Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> ---
>  daxctl/device.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/daxctl/device.c b/daxctl/device.c
> index 83913430..83c61389 100644
> --- a/daxctl/device.c
> +++ b/daxctl/device.c
> @@ -675,6 +675,13 @@ static int dev_destroy(struct daxctl_dev *dev)
>  		return rc;
>  
>  	rc = daxctl_region_destroy_dev(daxctl_dev_get_region(dev), dev);
> +	/*
> +	 * The kernel treats daxX.0 specially. It can't be deleted to ensure
> +	 * there is always a /sys/bus/dax/ present. If this happens, an
> +	 * EBUSY is returned. Expect it and don't treat it as an error.
> +	 */
> +	if (daxctl_dev_get_id(dev) == 0 && rc == -EBUSY)
> +		return 0;
>  	if (rc < 0)
>  		return rc;
>  
> 

  parent reply	other threads:[~2024-04-15 16:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-12 21:05 [PATCH ndctl 0/2] daxctl: Fix error handling and propagation in daxctl/device.c Vishal Verma
2024-04-12 21:05 ` [PATCH ndctl 1/2] daxctl/device.c: Handle special case of destroying daxX.0 Vishal Verma
2024-04-12 21:09   ` Dan Williams
2024-04-15 16:17   ` Dave Jiang [this message]
2024-04-12 21:05 ` [PATCH ndctl 2/2] daxctl/device.c: Fix error propagation in do_xaction_device() Vishal Verma
2024-04-12 21:30   ` Dan Williams
2024-04-12 21:42     ` Verma, Vishal L
2024-04-15 16:19   ` Dave Jiang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=308450ff-00ad-4884-a62e-22d69a4727db@intel.com \
    --to=dave.jiang@intel.com \
    --cc=alison.schofield@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=ira.weiny@intel.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=nvdimm@lists.linux.dev \
    --cc=vishal.l.verma@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox