LinuxQuestions.org
Visit Jeremy's Blog.
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 10-18-2011, 11:24 AM   #1
praveen_218
LQ Newbie
 
Registered: Mar 2008
Posts: 8

Rep: Reputation: 0
A hang issue on trying to port a working filesystem from 2.6.18.* to 2.6.32.46 ...


Hi,
I ported a file system from Kernel version 2.6.18.* to 2.6.32.46 (RHEL6.1) as the 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-18-2011 at 11:24 PM.
 
  


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
[SOLVED] Help...!!! Popen() hang issue shankar.489 Linux - Newbie 4 04-06-2011 01:32 AM
Filesystem/mount problem?? .... df and ls -l (ll) from / cause ssh session hang. scarpozzi Linux - Server 2 02-09-2011 08:46 AM
iptables port forwarding not working - routing issue huafist Linux - Networking 7 02-01-2011 09:39 AM
[SOLVED] Bash Serial port Script wont hang up mmof Linux - Newbie 3 10-26-2010 01:16 PM
serial port is getting hang shariefbe Linux - Software 6 01-18-2010 03:22 AM

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

All times are GMT -5. The time now is 03:52 PM.

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