LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 04-28-2016, 03:07 AM   #1
kalai_karthick
LQ Newbie
 
Registered: Apr 2016
Posts: 2

Rep: Reputation: Disabled
Why do we need sleep in reread_disk_partition function in sfdisk?


I am facing an issue while partitioning my disk using sfdisk.
I have partitioned my disk using sfdisk. And the (7)partitions got created successfully. sfdisk -l also lists all the (7) partitions which I configured. But the strange thing is, the corresponding block files for (6th and 7th) /dev/sdX6,/dev/sdX7 are missing. I could not figure out what is going wrong. I could see the following messages while using sfdisk command.

"Successfully wrote the new partition table

Re-reading the partition table ...
BLKRRPART: Device or resource busy
The command to re-read the partition table failed.
Run partprobe(8), kpartx(8) or reboot your system now,
before using mkfs"

So I was just going through the sfdisk source code to understand the issue. I found

reread_disk_partition(char *dev, int fd) {
printf(_("Re-reading the partition table ...\n"));
fflush(stdout);
sync();
sleep(3); /* superfluous since 1.3.20 */ <<<<<------------------

if (reread_ioctl(fd) && is_blockdev(fd))
........
}

sleep for 3 seconds. Anyone aware of why this sleep is needed? I am thinking of increasing the sleep to 5 seconds. Will it solve my problem?

Last edited by kalai_karthick; 04-28-2016 at 07:25 AM.
 
Old 04-28-2016, 06:47 AM   #2
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940
Guess it depends on what your problem is, aye?

Why don't you start by telling us that?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Regarding Sleep() function in c jyothidamu Programming 25 03-28-2011 05:38 AM
use of sleep function in fedora shivi91 Programming 2 03-03-2011 09:17 PM
Use of Sleep function in Perl Russell Griffiths Programming 2 08-14-2006 04:37 AM
looking for a Sleep() function Mike Davies Linux - Software 2 10-25-2004 08:11 AM
Is the wait function is the same as the sleep function ? Linh Programming 3 04-28-2004 12:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 02:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration