Peter Teoh | 1 Nov 2011 01:39
Picon
Gravatar

Re: seagate drive and i/o errors

care to describe the error?   i suspect it may be hardware error.
just post your dmesg after u plug in the hardware device.   perhaps do
a lsusb -vv and show us the details of the drive?

For automatically mounting filesystem, if u are on ubuntu:

https://help.ubuntu.com/community/Fstab

(just update the fstab file) is one option.

Alternatively is automount (and using autofs kernel module) is another
option.   If u are on linux kernel 3.1.0 (mine) the kernel module is
called autofs4, not sure what is the difference, but nevertheless just
do a "modprobe autofs" (not default loaded for me):

https://help.ubuntu.com/community/Autofs

On Sat, Oct 22, 2011 at 1:47 AM, Littlefield, Tyler <tyler <at> tysdomain.com> wrote:
> Hello all,
> I have a quick question. When I do a ls on this drive and it's spun
> down, i get an i/o error. I'm curious if there's a way to write a module
> or do something to make the drive wake up when I do a r/w request on it?
> I've had an external and it never had this problem. I also know i could
> modify the scsi params to make it not sleep, but that doesn't work and
> that is not the best of ideas anyway. I like it sleeping, I don't even
> mind waiting for an LS. It's just hard to manage when i have to umount
> -l the directory, then figure out what sd* dev it's on.
>
> --
>
(Continue reading)

Prajosh Premdas | 2 Nov 2011 10:01
Picon

spin_lock behavior

Hi 


I wrote a sample module which looked like this and i expected the module to hang as i have used 2 spin_lock simultaneously. But i find the print after the second spin_lock being printed and the module works perfectly fine. Can any body please help me in understanding this? I got this problem from a driver i wrote and had a typo "spin_lock" instead of "spin_unlock" the driver worked fine and i caught the mistake only during a review 

#include <linux/module.h>
#include <linux/spinlock.h>

struct sp_q {
spinlock_t spinlock;
uint8_t data;
};

static int __init sp_lck_init(void)
{

   struct sp_q test;
   
   /* Spin lock Init */

   spin_lock_init(&test.spinlock);
    
   printk("<1>Test start\n");
   
   spin_lock(&test.spinlock);
   test.data = 0;   
   spin_lock(&test.spinlock);   
   
   printk("<1>How come???\n");
   return 0;

}

static void __exit sp_lck_exit(void)
{

}

module_init(sp_lck_init);
module_exit(sp_lck_exit);
MODULE_LICENSE("GPL");

--
Regards,

Prajosh Premdas
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies <at> kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Prajosh Premdas | 2 Nov 2011 14:53
Picon

spin_lock behavior

Hi 

I wrote a sample module which looked like this and i expected the module to hang as i have used 2 spin_lock simultaneously. But i find the print after the second spin_lock being printed and the module works perfectly fine. Can any body please help me in understanding this? I got this problem from a driver i wrote and had a typo "spin_lock" instead of "spin_unlock" the driver worked fine and i caught the mistake only during a review 

#include <linux/module.h>
#include <linux/spinlock.h>

struct sp_q {
spinlock_t spinlock;
uint8_t data;
};

static int __init sp_lck_init(void)
{

   struct sp_q test;
   
   /* Spin lock Init */

   spin_lock_init(&test.spinlock);
    
   printk("<1>Test start\n");
   
   spin_lock(&test.spinlock);
   test.data = 0;   
   spin_lock(&test.spinlock);   
   
   printk("<1>How come???\n");
   return 0;

}

static void __exit sp_lck_exit(void)
{

}

module_init(sp_lck_init);
module_exit(sp_lck_exit);
MODULE_LICENSE("GPL");

--
Regards,

Prajosh Premdas
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies <at> kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Daniel Baluta | 3 Nov 2011 23:04
Picon
Gravatar

Re: spin_lock behavior

Hello,

> I wrote a sample module which looked like this and i expected the module to
> hang as i have used 2 spin_lock simultaneously. But i find the print after
> the second spin_lock being printed and the module works perfectly fine. Can
> any body please help me in understanding this? I got this problem from a
> driver i wrote and had a typo "spin_lock" instead of "spin_unlock" the
> driver worked fine and i caught the mistake only during a review

Are you running your tests on an UP with preemption disabled?

thanks,
Daniel.
Jeff Haran | 3 Nov 2011 23:11
Favicon

RE: spin_lock behavior

 

 

From: kernelnewbies-bounces <at> kernelnewbies.org [mailto:kernelnewbies-bounces <at> kernelnewbies.org] On Behalf Of Prajosh Premdas
Sent: Wednesday, November 02, 2011 2:02 AM
To: kernelnewbies <at> kernelnewbies.org
Subject: spin_lock behavior

 

Hi 

 

I wrote a sample module which looked like this and i expected the module to hang as i have used 2 spin_lock simultaneously. But i find the print after the second spin_lock being printed and the module works perfectly fine. Can any body please help me in understanding this? I got this problem from a driver i wrote and had a typo "spin_lock" instead of "spin_unlock" the driver worked fine and i caught the mistake only during a review 

 

#include <linux/module.h>

#include <linux/spinlock.h>

 

struct sp_q {

spinlock_t spinlock;

uint8_t data;

};

 

static int __init sp_lck_init(void)

{

 

   struct sp_q test;

   

   /* Spin lock Init */

 

   spin_lock_init(&test.spinlock);

    

   printk("<1>Test start\n");

   

   spin_lock(&test.spinlock);

   test.data = 0;   

   spin_lock(&test.spinlock);   

   

   printk("<1>How come???\n");

   return 0;

 

}

 

static void __exit sp_lck_exit(void)

{

 

}

 

module_init(sp_lck_init);

module_exit(sp_lck_exit);

MODULE_LICENSE("GPL");

 

--
Regards,

Prajosh Premdas

 

On single processor systems, spin_lock() doesn’t actually spin on anything.

 

The term spin_lock() is a bit of a misnomer in my opinion as it implies that some sort of spinning will go on if the lock has already been taken.

 

It really means, sort of, “disable preemption, then serialize access on this variable among other threads on other CPUs, and I promise not to try to take this lock in any top or bottom half context on this CPU.”

 

Of course, that would make for an unwieldy function name, so its call spin_lock().

 

Jeff Haran

 

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies <at> kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
vichy | 1 Nov 2011 14:08
Picon

when and how Notifier Chains calling?

hi all:
if I register a user-defined notification chain as below:
blocking_notifier_chain_register(&my_noti_chain, &my_notifier);
under what circumstances it will be called?

Regards,
piyush moghe | 1 Nov 2011 14:23
Picon

Re: ext4 extents



Hi Mike,

I'm updating a user space program that finds free blocks on a ext2/3 filesystem so that it works with ext4.  I'm concerned about how extents might affect my program.  My program currently looks only at the block allocation bitmaps.  Are the block allocation bitmaps still updated when an extent is created?

>> AFAIK block allocations bitmaps are sufficient to give you information related to block allocations, inode with extents should not 
>> make any difference because extents are just to make block reading efficient and can be used to represent a much bigger FS.

>From what I can tell, extent information is only stored in the inode, and is only a way to improve the efficiency of the process of creating the structure needed in the inode.  But I haven't been able to find out anything about whether the block allocation bitmap is updated at the same time.

>> As part of  extent inode allocation block bitmaps are updated for eg. you can refer to 
>> ext4_map_blocks
>>      ext4_ext_map_blocks ( Only called if inode has extents )
>>          ext4_free_blocks
>>               ext4_read_block_bitmap 

Regards,
Piyush

On Sat, Oct 29, 2011 at 3:33 AM, Mike Gibson <mike.gibson <at> storagecraft.com> wrote:
I'm updating a user space program that finds free blocks on a ext2/3 filesystem so that it works with ext4.  I'm concerned about how extents might affect my program.  My program currently looks only at the block allocation bitmaps.  Are the block allocation bitmaps still updated when an extent is created?

>From what I can tell, extent information is only stored in the inode, and is only a way to improve the efficiency of the process of creating the structure needed in the inode.  But I haven't been able to find out anything about whether the block allocation bitmap is updated at the same time.

Do extents provide a new way of expressing which blocks are allocated on disk?  Or are the block allocation bitmaps still the canonical way to determine if a given block is in use?

Mike Gibson
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies <at> kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


_______________________________________________
Kernelnewbies mailing list
Kernelnewbies <at> kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Mulyadi Santosa | 4 Nov 2011 03:07
Picon

Re: Question on CDROM access

On Tue, Nov 1, 2011 at 06:42, sahlot arvind <asahlot <at> gmail.com> wrote:
> I tried the followings and nothing gave anything:
>
> 'lsof | grep -in 'cdrom'
> 'lsof | grep -in 'sr0'
> 'lsof | grep -in 'sg0'
>
> What tools could I use to track down the process, which is accessing my CD
> drive?

just my own speculation, maybe you could use blktrace.

--

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com
Srivatsa Bhat | 4 Nov 2011 05:17
Picon

Re: when and how Notifier Chains calling?



On Tue, Nov 1, 2011 at 6:38 PM, vichy <vichy.kuo <at> gmail.com> wrote:
hi all:
if I register a user-defined notification chain as below:
blocking_notifier_chain_register(&my_noti_chain, &my_notifier);
under what circumstances it will be called?


Hi,

If you are asking when does the above register function will be called,
then you should call it whenever any other code path tries to register its
callback function to your new notifier event.

However, in case you are asking when the actual callbacks registered for
your new notifier are called, then they are called when you call
blocking_notifier_call_chain() function.

Refer to kernel/power/main.c for an example.

Regards,
Srivatsa S. Bhat
 
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies <at> kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Jimmy Pan | 4 Nov 2011 05:44
Picon

Re: why does the kernel use mutex to protect the address_space structure

On Tue, Nov 1, 2011 at 3:57 AM, Zheng Da <zhengda1936 <at> gmail.com> wrote:
> Hello,
>
> I try to understand why the kernel uses mutex to protect the
> address_space structure. I checked the critical areas protected by
> i_mmap_mutex, and didn't see these areas use IO. I don't see why we
> can't use spin locks. Do I miss something? It seems most of critical
> areas provided by i_mmap_mutex aren't very large.
>
> Thanks,
> Da
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies <at> kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>

In my knowledge, when you use mutex, you can go to sleep, if you use spin lock,
the thread has to busy wait, spin lock causes cpu waste, while mutex
cannot be used
under interrupt context.

Regards,
Jimmy

Gmane