A system hang issue in porting an old fs to kernel 2.6.32.*


 
Thread Tools Search this Thread
Top Forums Programming A system hang issue in porting an old fs to kernel 2.6.32.*
# 1  
Old 10-18-2011
A system hang issue in porting an old fs to kernel 2.6.32.*

Hi,
I ported a file system from Kernel version 2.6.18.* to 2.6.32.46 as VFS implementation has changed and prepare_write/commit_write are replaced by write_begin/write_end pairs.

Implemented the feature by writing a wrapper for write_begin and write_end and calling original functions for prepare_write and commit_write respectively by drawing the parameters prepare_write/commit_write need.

like :
Code:
int myNewfs_write_begin(struct file *file, struct address_space *mapping,
                             loff_t pos, unsigned len, unsigned flags,
                             struct page **pagep, void **fsdata) {

         struct inode *inode = mapping->host;
         int ret, error, retStatus;
         int retries = 0;
         struct page *page;
         pgoff_t index;
         unsigned from, to;
         int needed_blocks = ext3_writepage_trans_blocks(inode) + 1;
         ret = 0;
         error = 0;
         retries = 0;
         index = pos >> PAGE_CACHE_SHIFT;
         from = pos & (PAGE_CACHE_SIZE - 1);
         to = from + len;
   
    findpage:
             page=NULL;
             page = grab_cache_page_write_begin(mapping, index, flags);
             if (!page) {
                  return -ENOMEM;
             }
              /*
              ** Calling the original _My_OldFS_prepare_write.
              ** The call ensures the same old handling of
              ** the filesystem wraped with the new VFS APIs.
              */
              *pagep = page;
              retStatus = _My_OldFS_prepare_write(file, page, from, to);
    return retStatus;
}

//Similarly,

int _myNewfs_write_end(struct file *file, struct address_space *mapping, loff_t pos, unsigned len, unsigned copied,
                     struct page *page, void *fsdata) {

         unsigned start, ret;
         start = pos & (PAGE_CACHE_SIZE - 1);
         struct inode *inode = mapping->host;
         /* This could be a short (even 0-length) commit */
         ret = 0;
         /*
         ** Calling OLD Commit Write.
         */
         ret = _myOldFS_commit_write(file, page, start, start+copied);
         /*
         ** Update the radix page ref count.
         */
         //mapping->nrpages--;
         /*
         ** Unlock the page, locked from the write_begin.
         */
          unlock_page(page);
         /*
         ** Release the page.
         */
         //flush_dcache_page(page);
         page_cache_release(page);
         return ret? ret : copied;
}


The issue is that despite the new write is working, I'm observing a kernel hang except in situations when I fire 'sync' command from the prompt and in which case the kernel doesn't hang.

sync is flushing back dirty pages, hence at some point I tried using flush_dcache_page(page) too but the problem persisted.

A simple cp <some file to copy> </mnt/My_Newfs_MountPoint/abc.txt> hangs, if I don't use sync immediately following the cp operation and this hang is temporary and the system bounces back in a minutes time, leaving a dump under /var/crash/<core file> directory, unmounting the filesystem.

However, when I use the sync command within some time (say 5 to 10 seconds) the cp command succeed and the file gets copied perfectly without any issue on my new filesystem.

I'm using a VM for this purpose.

Any input/pointer from anyone is appreciated.
Thanks in advance.

Last edited by Praveen_218; 10-19-2011 at 01:17 AM.. Reason: Typo errors fixed ...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to solve hang issue in script?

i have one function block in the beginning of my script and there are some commands inside that function which will perform some operations. And i am invoking that function from my main script by passing some values. Sometimes it is hanging in the middle for some value. For example: For 1st... (3 Replies)
Discussion started by: thomasraj87
3 Replies

2. Linux

Makefile issue during porting.

Hello Forum memebers, I am kshyap kumran from bangalore india. I working on porting project from solaris to linux ie C++ application porting from solaris to linux.while compiling on linux box i facing some issues.As i am new to linux environment i was blocked in the below mentioned... (1 Reply)
Discussion started by: kshyap
1 Replies

3. Shell Programming and Scripting

how do i avoid system hang due to ssh in script?

I have a script that collects data from about 200 servers using 'ssh'. The problem is that, process sometime hangs at some point stopping the execution of the script. Please give me some idea how can I force the execution to jump to the next step if there arises any problem !! Thanks for replies if... (1 Reply)
Discussion started by: mdangol
1 Replies

4. Linux

Linux System became hang-up

Hi all, I am working on Red hat Linux 2.6 and I am trying to compile some java files and when I am trying to do it,it compiles some file and then became hang up and doesn't allow me to do any operation.. I write one ksh script to compile all files by this script and move those file in... (1 Reply)
Discussion started by: smartgupta
1 Replies

5. Solaris

Zone hang issue

I have a solaris10 zone running an oracle db in it. The zone hangs after some time the db is started and i 'm unable to log into the zone after that so i have to halt and restart the zone along with db .. but after few hrs again it hangs. What would be the reason for it. I did svcs -xv and got... (13 Replies)
Discussion started by: fugitive
13 Replies

6. Solaris

Which file is read by kernel to set its default system kernel parameters values?

Hi gurus Could anybody tell me which file is read by kernel to set its default system kernal parameters values in solaris. Here I am not taking about /etc/system file which is used to load kernal modules or to change any default system kernal parameter value Is it /dev/kmem file or something... (1 Reply)
Discussion started by: girish.batra
1 Replies

7. Solaris

Solaris 10 CDE hang issue

Hi, I am facing some issues on Solaris 10 (SPARC 5.10 Generic_118833-36). The issue is when I try to connect/login through CDE it hangs (hangs at login screen). I tried connecting thourgh VNC client also but that also not helped. I had done no configuration change or modified any kernel... (2 Replies)
Discussion started by: kgupta
2 Replies

8. AIX

Port hang issue in AIX Version 5.3

On AIX platform we are having Weblogic 8.1 as the middleware for an application. The application is deployed in Weblogic on AIX platform and the server is having 2 dedicated listening ports for any incoming requests. Output for netstat -an command for the port 30001 is as follows:- tcp4... (7 Replies)
Discussion started by: subharai
7 Replies

9. Red Hat

system hang

Hello, I am having a HP proliant 350 G3 sever installed wih RedHat linux 9.0 when I enterd using any user(Except root) the server hanged after few seconds, also the folder icons are blacked out and the names of the folder icons are disapper. can any body help me. Ajay (1 Reply)
Discussion started by: ajay234
1 Replies

10. UNIX for Dummies Questions & Answers

System hang in New Kernel.

Im having a problem, Any want know why after ive upgrade from Linux 7.0 to 7.1 ( 2.4.2-2 ) My mouse is having problem. If i drag a content in my Desktop let say an icon suddently the mouse stops moving ( Hang / freeze ) i need to do a hard reboot everytime to make it comes to normal. If... (4 Replies)
Discussion started by: killerserv
4 Replies
Login or Register to Ask a Question