Skip to contentSkip to conversation

What is the logic behind 'Device or resource busy' ?

DISCUSSION Jure Pecar 4 participants 8 messages May 26, 2003 – May 30, 2003 MD RAID

lore
Share & tools
lore

Jure Pecar

author
#0 lore raw

Hi all,

Consider the situation where a drive sdx gets kicked out of a mirror md9. If i want to add it back with mdadm /dev/md9 -a /dev/sdx1, i get the 'device busy' error.

However, if i stop the mirror and start it right after, i can easily add the sdx1 back into md9. But this also requires me to stop any services using this mirror and unmount the filesystem on it...

Any particular reason that this must work that way?

Signature · 1 line
Jure Pecar
#1 lore raw

i don't know the mdadm equivalent, but i do raidhotremove followed by raidhotadd to get around that issue. if you look at /proc/mdstat after the failure, you'll probably see the drive is still part of the array, but just marked as down. raidhotremove tells the system it is gone and then you can add it back.

#2 lore raw

How do we handle the same but uptodated data to disk cache?

Hello,

I want to write the data to the fixed sector with the same size frequently just like MD super block, but I do not want to sync and flush the dev on each write.

For example, to write md super block in /drivers/md/md.c

we do

        fsync_dev(dev);
        bh=getblk(dev, block, size);

        mark_buffer_uptodate(bh,1);
        mark_buffer_dirty(bh);
        ll_rw_block(WRITE,1, &bh);
        wait_on_buffer(bh);
        brelse(bh);
        fsync_dev(dev);

Instead, Can I do as follow

        bh=getblk(dev, block, size);
        if (buffer_uptodate(bh)) { /* still in cache, not flushed yet */
           bh->b_data = new SB data;
            brelse(bh);
        }
        else { /* it must be flushed */
            same as in above
       }

Please provide me your openion or suggestions.

Thanks in advance,

Bo

#3 lore raw

Re: How do we handle the same but uptodated data to disk cache?

Quoted 7 lines · On Monday May 26, [email protected] wrote:

Hello,

I want to write the data to the fixed sector with the same size frequently just like MD super block, but I do not want to sync and flush the dev on each write.

For example, to write md super block in /drivers/md/md.c

I suggest you look at a newer md.c. With 2.4.21pre or 2.5.* have "sync_page_io" which does what you want more effectively.

NeilBrown

#4 lore raw

Re: How do we handle the same but uptodated data to disk cache?

Neil,

It improved a lot for the sync I/O. However, I am looking for a solution to handle the regular async I/O with a page data on the same sector repeatedly like writing the MD SB data to disk without flushing.

The follwing is my simple algorithm for it;

        bh=getblk(dev, block, size);
        if (buffer_uptodate(bh)) { /* still in cache, not flushed yet */
              bh->b_data = "updated data";
              brelse(bh);
        }
        else { /* all were flushed or new  */
            .
            .
             mark_buffer_uptodate(bh,1);
             mark_buffer_dirty(bh);
            generic_make_request(rw, &bh);
       }

Please give me your suggestion or comment.

Bo
----- Original Message -----
From: "Neil Brown" <[email protected]>
To: "bmoon" <[email protected]>
Cc: <[email protected]>
Sent: Monday, May 26, 2003 7:47 PM
Subject: Re: How do we handle the same but uptodated data to disk cache?

Quoted 4 lines · On Monday May 26, [email protected] wrote:
Quoted 3 lines

Hello,

I want to write the data to the fixed sector with the same size

frequently

Quoted 10 lines
Quoted 4 lines

just like MD super block, but I do not want to sync and flush the dev on each write.

For example, to write md super block in /drivers/md/md.c

I suggest you look at a newer md.c. With 2.4.21pre or 2.5.* have "sync_page_io" which does what you want more effectively.

NeilBrown

#5 lore raw

Re: How do we handle the same but uptodated data to disk cache?

Help!
There must be a function which will update the data in the disk cache. From __make_request(), it does ordering(neighboring) the requests, it does not deal with the same block request.

Please give me a light!

Quoted 22 lines

It improved a lot for the sync I/O. However, I am looking for a solution to handle the regular async I/O with a page data on the same sector repeatedly like writing the MD SB data to disk without flushing.

The follwing is my simple algorithm for it;

        bh=getblk(dev, block, size);
        if (buffer_uptodate(bh)) { /* still in cache, not flushed yet */
              bh->b_data = "updated data";
              brelse(bh);
        }
        else { /* all were flushed or new  */
            .
            .
             mark_buffer_uptodate(bh,1);
             mark_buffer_dirty(bh);
            generic_make_request(rw, &bh);
       }
Quoted 2 lines

Please give me your suggestion or comment.

Bo

#6 lore raw

Re: How do we handle the same but uptodated data to disk cache?

In reply to bmoon
Quoted 7 lines · On Tuesday May 27, [email protected] wrote:

Neil,

It improved a lot for the sync I/O.
However, I am looking for a solution to handle
the regular async I/O with a page data on the
same sector repeatedly like writing the MD SB
data to disk without flushing.

This is a filesystem question. Not a raid question.

I would just:
getblk
copy new data in
mark update
mark dirty
release block

and it will eventually be flushed to disk.
If you want to written sooner, call
submit_bh

NeilBrown

Quoted 48 lines

The follwing is my simple algorithm for it;

        bh=getblk(dev, block, size);
        if (buffer_uptodate(bh)) { /* still in cache, not flushed yet */
              bh->b_data = "updated data";
              brelse(bh);
        }
        else { /* all were flushed or new  */
            .
            .
             mark_buffer_uptodate(bh,1);
             mark_buffer_dirty(bh);
            generic_make_request(rw, &bh);
       }

Please give me your suggestion or comment.

Bo
----- Original Message -----
From: "Neil Brown" <[email protected]>
To: "bmoon" <[email protected]>
Cc: <[email protected]>
Sent: Monday, May 26, 2003 7:47 PM
Subject: Re: How do we handle the same but uptodated data to disk cache?

Quoted 4 lines · On Monday May 26, [email protected] wrote:
Quoted 3 lines

Hello,

I want to write the data to the fixed sector with the same size

frequently

Quoted 10 lines
Quoted 4 lines

just like MD super block, but I do not want to sync and flush the dev on each write.

For example, to write md super block in /drivers/md/md.c

I suggest you look at a newer md.c. With 2.4.21pre or 2.5.* have "sync_page_io" which does what you want more effectively.

NeilBrown

-
To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#7 lore raw
In reply to Joe Pruett
Quoted 6 lines · On Mon, 26 May 2003 17:39:45 -0700 (PDT) Joe Pruett <[email protected]> wrote:

i don't know the mdadm equivalent, but i do raidhotremove followed by raidhotadd to get around that issue. if you look at /proc/mdstat after the failure, you'll probably see the drive is still part of the array, but

just marked as down. raidhotremove tells the system it is gone and then you can add it back.

hm yes... a failed drive is still present and has to be removed. makes sense now, thanks.

Signature · 1 line
Jure Pecar