From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dave Hansen Subject: race with i_flock? Date: Tue, 16 Jul 2002 19:27:00 -0700 Sender: linux-fsdevel-owner@vger.kernel.org Message-ID: <3D34D5F4.2060008@us.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Cc: linux-fsdevel@vger.kernel.org Return-path: To: Matthew Wilcox List-Id: linux-fsdevel.vger.kernel.org I've been getting some funny freezes while running Specweb. I don't think this is the cause, but I did run into it. Program received signal SIGSEGV, Segmentation fault. 0xc0147540 in may_open (nd=0xdaa69f78, acc_mode=6, flag=3) at /home/dave/oprofile/linux-2.5.25/include/linux/fs.h:1047 which is: static inline int get_lease(struct inode *inode, unsigned int mode) { ------->if (inode->i_flock && (inode->i_flock->fl_flags & FL_LEASE)) return __get_lease(inode, mode); return 0; } It appears that i_flock is NULL: (gdb) print inode $1 = (struct inode *) 0xe8d638f0 (gdb) print *inode $2 = {...big snip i_flock = 0x0, ...} (gdb) print &inode->i_flock $3 = (struct file_lock **) 0xe8d6396c But, there was a check for that just a second earlier. Looks racy to me. I noticed that there is use of i_sem in some of the calling functions, but not in get_lease()'s call sequence. Is this a problem? A quick grep for i_flock didn't show any obvious places where it was set back to NULL. #0 0xc0147540 in may_open (nd=0xdaa69f78, acc_mode=6, flag=3) at /home/dave/oprofile/linux-2.5.25/include/linux/fs.h:1047 #1 0xc014786c in open_namei (pathname=0xe7292000 "/mnt/sdc1/www/post.log", flag=3, mode=438, nd=0xdaa69f78) at namei.c:1294 #2 0xc013bcbb in filp_open (filename=0xe7292000 "/mnt/sdc1/www/post.log", flags=2, mode=438) at open.c:616 #3 0xc013c0df in sys_open (filename=0x8130cd0 "/mnt/sdc1/www/post.log", flags=2, mode=438) at open.c:806 #4 0xc0106fbb in syscall_call () -- Dave Hansen haveblue@us.ibm.com