Incremental: remove obsoleted calls to udisks
PATCH v5 1/1 Incremental: remove obsoleted calls to udisks
Utility udisks is removed from udev upstream, calling this obsoleted command in run_udisks() doesn't make any sense now.
This patch removes the calls chain of udisks, which includes routines run_udisk(), force_remove(), and 2 locations where force_remove() are called. Considering force_remove() is removed with udisks util, it is fair to remove Manage_stop() inside force_remove() as well.
In the two modifications where calling force_remove() are removed, the failure from Manage_subdevs() can be safely ignored, because,
1) udisks doesn't exist, no need to check the return value to umount the file system by udisks and remove the component disk again.
2) After the 'I' inremental remove, there is another 'r' hot remove following up. The first incremental remove is a best-try effort.
Therefore in this patch, where force_remove() is removed, the return value of calling Manage_subdevs() is not checked too.
---
Changelog,
v5: change Mariusz's email address as he suggested
v4: add Reviewed-by from Mariusz.
v3: remove the almost-useless warning message, and make the change
more simplified.
v2: improve based on code review comments from Mariusz.
v1: initial version.
Incremental.c | 64 +++++++++++---------------------------------------- 1 file changed, 13 insertions(+), 51 deletions(-)
Incremental.c +13 -51
@@ -1628,54 +1628,18 @@ release:return rv; } -static void run_udisks (char *arg1,char *arg2) -{ -int pid =fork (); -int status; -if (pid ==0 ) { -manage_fork_fds (1 ); -execl ("/usr/bin/udisks" ,"udisks" , arg1, arg2,NULL ); -execl ("/bin/udisks" ,"udisks" , arg1, arg2,NULL ); -exit (1 ); - } -while (pid >0 &&wait (&status) != pid) - ; -} - -static int force_remove (char *devnm,int fd,struct mdinfo *mdi,int verbose) -{ -int rv; -int devid =devnm2devid (devnm); - -run_udisks ("--unmount" ,map_dev (major (devid),minor (devid),0 )); - rv =Manage_stop (devnm, fd, verbose,1 ); -if (rv) { -/* At least we can try to trigger a 'remove' */ -sysfs_uevent (mdi,"remove" ); -if (verbose) -pr_err ("Fail to stop %s too.\n" , devnm); - } -return rv; -} -static void remove_from_member_array (struct mdstat_ent *memb,struct mddev_dev *devlist,int verbose) { -int rv; -struct mdinfo mmdi;int subfd =open_dev (memb->devnm);if (subfd >=0 ) { - rv =Manage_subdevs (memb->devnm, subfd, devlist, verbose, -0 ,UOPT_UNDEFINED ,0 ); -if (rv &2 ) { -if (sysfs_init (&mmdi,-1 , memb->devnm)) -pr_err ("unable to initialize sysfs for: %s\n" , - memb->devnm); -else -force_remove (memb->devnm, subfd, &mmdi, - verbose); - } +/* +* Ignore the return value because it's necessary +* to handle failure condition here. +*/ +Manage_subdevs (memb->devnm, subfd, devlist, verbose, +0 ,UOPT_UNDEFINED ,0 );close (subfd); } }
@@ -1758,21 +1722,19 @@ int IncrementalRemove(char *devname, char *id_path, int verbose) }free_mdstat (mdstat); }else { - rv |=Manage_subdevs (ent->devnm, mdfd, &devlist, - verbose,0 ,UOPT_UNDEFINED ,0 ); -if (rv &2 ) { -/* Failed due to EBUSY, try to stop the array. -* Give udisks a chance to unmount it first. +/* +* This 'I' incremental remove is a try-best effort, +* the failure condition can be safely ignored +* because of the following up 'r' remove. */ - rv =force_remove (ent->devnm, mdfd, &mdi, verbose); - goto end; - } +Manage_subdevs (ent->devnm, mdfd, &devlist, + verbose,0 ,UOPT_UNDEFINED ,0 ); } devlist.disposition ='r' ; rv =Manage_subdevs (ent->devnm, mdfd, &devlist, verbose,0 ,UOPT_UNDEFINED ,0 ); -end: +close (mdfd);free_mdstat (ent);return rv;
Signature · 1 line
2.35.3
Quoted 30 lines · Coly Li
Utility udisks is removed from udev upstream, calling this obsoleted command in
run_udisks()doesn't make any sense now.This patch removes the calls chain of udisks, which includes routines
run_udisk(),force_remove(), and 2 locations whereforce_remove()are called. Consideringforce_remove()is removed with udisks util, it is fair to removeManage_stop()insideforce_remove()as well.In the two modifications where calling
force_remove()are removed, the failure fromManage_subdevs()can be safely ignored, because,
1) udisks doesn't exist, no need to check the return value to umount the file system by udisks and remove the component disk again.
2) After the 'I' inremental remove, there is another 'r' hot remove following up. The first incremental remove is a best-try effort.Therefore in this patch, where
force_remove()is removed, the return value of callingManage_subdevs()is not checked too.Signed-off-by Coly Li <[email protected]>Reviewed-by Mariusz Tkaczyk <[email protected]>Cc Jes Sorensen <[email protected]>---
Changelog,
v5: change Mariusz's email address as he suggested
v4: add Reviewed-by from Mariusz.
v3: remove the almost-useless warning message, and make the change
more simplified.
v2: improve based on code review comments from Mariusz.
v1: initial version.
Quoted 2 lines
Incremental.c | 64 +++++++++++---------------------------------------- 1 file changed, 13 insertions(+), 51 deletions(-)
Been out of the loop for a while, trying to catch up.
Mariusz, do you consider this one good to go now? You were the one providing feedback multiple times.
Thanks,
Jes
Quoted 34 lines · On Fri, 1 Sep 2023 11:47:09 -0400 Jes Sorensen <[email protected]> wrote:
Quoted 30 lines · Coly Li
Utility udisks is removed from udev upstream, calling this obsoleted command in
run_udisks()doesn't make any sense now.This patch removes the calls chain of udisks, which includes routines
run_udisk(),force_remove(), and 2 locations whereforce_remove()are called. Consideringforce_remove()is removed with udisks util, it is fair to removeManage_stop()insideforce_remove()as well.In the two modifications where calling
force_remove()are removed, the failure fromManage_subdevs()can be safely ignored, because,
1) udisks doesn't exist, no need to check the return value to umount the file system by udisks and remove the component disk again.
2) After the 'I' inremental remove, there is another 'r' hot remove following up. The first incremental remove is a best-try effort.Therefore in this patch, where
force_remove()is removed, the return value of callingManage_subdevs()is not checked too.Signed-off-by Coly Li <[email protected]>Reviewed-by Mariusz Tkaczyk <[email protected]>Cc Jes Sorensen <[email protected]>---
Changelog,
v5: change Mariusz's email address as he suggested
v4: add Reviewed-by from Mariusz.
v3: remove the almost-useless warning message, and make the change
more simplified.
v2: improve based on code review comments from Mariusz.
v1: initial version.Quoted 2 lines
Incremental.c | 64 +++++++++++---------------------------------------- 1 file changed, 13 insertions(+), 51 deletions(-)
Quoted 9 lines
Been out of the loop for a while, trying to catch up.
Mariusz, do you consider this one good to go now? You were the one providing feedback multiple times.
Thanks,
Jes
Hi Jes,
Yes, I see this as a good change. The current behavior is not stable, because udev is not able to "umount"- if array is not mounted it is stopped, otherwise not.
With the change, we will not try to stop it at all- fair for me, behavior is same every time. If we cannot stop array every time we should not try to.
Thanks,
Mariusz
Jes Sorensen
AppliedQuoted 47 lines · Mariusz Tkaczyk
Quoted 34 lines · On Fri, 1 Sep 2023 11:47:09 -0400 Jes Sorensen <[email protected]> wrote:
Quoted 30 lines · Coly Li
Utility udisks is removed from udev upstream, calling this obsoleted command in
run_udisks()doesn't make any sense now.This patch removes the calls chain of udisks, which includes routines
run_udisk(),force_remove(), and 2 locations whereforce_remove()are called. Consideringforce_remove()is removed with udisks util, it is fair to removeManage_stop()insideforce_remove()as well.In the two modifications where calling
force_remove()are removed, the failure fromManage_subdevs()can be safely ignored, because,
1) udisks doesn't exist, no need to check the return value to umount the file system by udisks and remove the component disk again.
2) After the 'I' inremental remove, there is another 'r' hot remove following up. The first incremental remove is a best-try effort.Therefore in this patch, where
force_remove()is removed, the return value of callingManage_subdevs()is not checked too.Signed-off-by Coly Li <[email protected]>Reviewed-by Mariusz Tkaczyk <[email protected]>Cc Jes Sorensen <[email protected]>---
Changelog,
v5: change Mariusz's email address as he suggested
v4: add Reviewed-by from Mariusz.
v3: remove the almost-useless warning message, and make the change
more simplified.
v2: improve based on code review comments from Mariusz.
v1: initial version.Quoted 2 lines
Incremental.c | 64 +++++++++++---------------------------------------- 1 file changed, 13 insertions(+), 51 deletions(-)Quoted 9 lines
Been out of the loop for a while, trying to catch up.
Mariusz, do you consider this one good to go now? You were the one providing feedback multiple times.
Thanks,
Jes
Quoted 8 lines
Hi Jes,
Yes, I see this as a good change. The current behavior is not stable, because udev is not able to "umount"- if array is not mounted it is stopped, otherwise not.
With the change, we will not try to stop it at all- fair for me, behavior is same every time. If we cannot stop array every time we should not try to.
Applied!
Thanks,
Jes