[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-ha-dev
Subject:    [Linux-ha-dev]  [patch] Filesystem RA support for tmpfs
From:       Endre Holecz <e-man () ghost ! hu>
Date:       2011-10-02 9:38:23
Message-ID: 4E88310F.2010307 () ghost ! hu
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hello,

sorry to be somewhat late. :) The /proc/filesystem check is necessary,
as there is no tmpfs module (compiled into the kernel, at least on
RHEL6 and derivatives), and modprobe fails.

That grep is indeed incorrect, because there are:

nodev  tmpfs
nodev  devtmpfs

lines in /proc/filesystem.

This one should work fine:

grep -e "\b$FSTYPE"'$' /proc/filesystems>/dev/null

Regards,
Endre



Hi,

On Sun, Aug 28, 2011 at 02:57:25PM +0200, Endre Holecz wrote:
> /  Hi,
/>/
/>/  I needed to mount tmpfs, but the current RA would fail, so I modified
/>/  it. The params would look like this:
/>/
/>/  device="none"
/>/  fstype="tmpfs"
/>/  directory="/foo"
/>/  options="size=512m"
/>/
/>/  Changes made:
/>/
/>/  - don't check for /dev/* if fstype is tmpfs
/>/  - blockdevice="no" for tmpfs
/>/  - first check /proc/filesystems and only modprobe when necessary
/
The first two are apparently unrelated to the third. Unless I'm
missing something. I'll apply all but that hunk.

The /proc/filesystems check part needs fixing:

grep -e "$FSTYPE"'$' /proc/filesystems

If there are two filesystems sharing a suffix, that can break.
Don't know how likely that is.

Best would be to create a function, say is_fs_supported, then
put a correct check over there.

> /  Patch is attached.
/
Many thanks for the patch.

Cheers,

Dejan

> /  Regards,
/>/  Endre Holecz
/
> /  --- Filesystem.orig	2011-08-25 23:20:04.000000000 +0200
/>/  +++ Filesystem	2011-08-28 11:51:00.101691214 +0200
/>/  @@ -236,7 +236,7 @@
/>/   	# Get the current real device name, if possible.
/>/   	# (specified devname could be -L or -U...)
/>/   	case "$FSTYPE" in
/>/  -	nfs|smbfs|cifs|none) ;;
/>/  +	nfs|smbfs|cifs|none|tmpfs) ;;
/>/   	*)	DEVICE=`list_mounts | grep " $MOUNTPOINT " | cut -d' ' -f1`
/>/   		if [ -b "$DEVICE" ]; then
/>/   		blockdevice=yes
/>/  @@ -417,7 +417,7 @@
/>/   	no)    false;;
/>/   	""|auto)
/>/   		case $FSTYPE in
/>/  -		    ext4|ext4dev|ext3|reiserfs|reiser4|nss|xfs|jfs|vfat|fat|nfs|cifs|smbfs|ocfs2|gfs2|none|lustre)
 />/  +		    tmpfs|ext4|ext4dev|ext3|reiserfs|reiser4|nss|xfs|jfs|vfat|fat|nfs|cifs|smbfs|ocfs2|gfs2|none|lustre)
 />/   			false;;
/>/   		*)
/>/   			true;;
/>/  @@ -461,8 +461,11 @@
/>/   		if [ -z "$FSTYPE" -o "$FSTYPE" = none ]; then
/>/   			: No FSTYPE specified, rely on the system has the right file-system support \
already />/   		else
/>/  -			# Insert Filesystem module
/>/  -			$MODPROBE $FSTYPE>/dev/null
/>/  +			grep -e "$FSTYPE"'$' /proc/filesystems>/dev/null
/>/  +			if [ $? -ne 0 ] ; then
/>/  +				# Insert Filesystem module
/>/  +				$MODPROBE $FSTYPE>/dev/null
/>/  +			fi
/>/   			grep -e "$FSTYPE"'$' /proc/filesystems>/dev/null
/>/   			if [ $? -ne 0 ] ; then
/>/   				ocf_log err "Couldn't find filesystem $FSTYPE in /proc/filesystems"
/>/  @@ -972,6 +975,8 @@
/>/   	;;
/>/   //[!/]*/*)	# An SMB filesystem specification...
/>/   	;;
/>/  +none)
/>/  +	;;
/>/   /dev/null)	# Special case for BSC
/>/   	blockdevice=yes
/>/   	;;/


[Attachment #5 (text/html)]

<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <pre>Hello,

sorry to be somewhat late. :) The /proc/filesystem check is necessary,
as there is no tmpfs module (compiled into the kernel, at least on
RHEL6 and derivatives), and modprobe fails.

That grep is indeed incorrect, because there are:

nodev  tmpfs
nodev  devtmpfs

lines in /proc/filesystem.

This one should work fine:

grep -e "\b$FSTYPE"'$' /proc/filesystems &gt;/dev/null

Regards,
Endre



Hi,

On Sun, Aug 28, 2011 at 02:57:25PM +0200, Endre Holecz wrote:
&gt;<i> Hi,
</i>&gt;<i>
</i>&gt;<i> I needed to mount tmpfs, but the current RA would fail, so I modified  
</i>&gt;<i> it. The params would look like this:
</i>&gt;<i>
</i>&gt;<i> device="none"
</i>&gt;<i> fstype="tmpfs"
</i>&gt;<i> directory="/foo"
</i>&gt;<i> options="size=512m"
</i>&gt;<i>
</i>&gt;<i> Changes made:
</i>&gt;<i>
</i>&gt;<i> - don't check for /dev/* if fstype is tmpfs
</i>&gt;<i> - blockdevice="no" for tmpfs
</i>&gt;<i> - first check /proc/filesystems and only modprobe when necessary
</i>
The first two are apparently unrelated to the third. Unless I'm
missing something. I'll apply all but that hunk.

The /proc/filesystems check part needs fixing:

grep -e "$FSTYPE"'$' /proc/filesystems

If there are two filesystems sharing a suffix, that can break.
Don't know how likely that is.

Best would be to create a function, say is_fs_supported, then
put a correct check over there.

&gt;<i> Patch is attached.
</i>
Many thanks for the patch.

Cheers,

Dejan

&gt;<i> Regards,
</i>&gt;<i> Endre Holecz
</i>
&gt;<i> --- Filesystem.orig	2011-08-25 23:20:04.000000000 +0200
</i>&gt;<i> +++ Filesystem	2011-08-28 11:51:00.101691214 +0200
</i>&gt;<i> @@ -236,7 +236,7 @@
</i>&gt;<i>  	# Get the current real device name, if possible.
</i>&gt;<i>  	# (specified devname could be -L or -U...)
</i>&gt;<i>  	case "$FSTYPE" in
</i>&gt;<i> -	nfs|smbfs|cifs|none) ;;
</i>&gt;<i> +	nfs|smbfs|cifs|none|tmpfs) ;;
</i>&gt;<i>  	*)	DEVICE=`list_mounts | grep " $MOUNTPOINT " | cut -d' ' -f1`
</i>&gt;<i>  		if [ -b "$DEVICE" ]; then
</i>&gt;<i>  		  blockdevice=yes
</i>&gt;<i> @@ -417,7 +417,7 @@
</i>&gt;<i>  	    no)    false;;
</i>&gt;<i>  	    ""|auto)
</i>&gt;<i>  		case $FSTYPE in
</i>&gt;<i> -		    ext4|ext4dev|ext3|reiserfs|reiser4|nss|xfs|jfs|vfat|fat|nfs|cifs|smbfs|ocfs2|gfs2|none|lustre)
 </i>&gt;<i> +		    tmpfs|ext4|ext4dev|ext3|reiserfs|reiser4|nss|xfs|jfs|vfat|fat|nfs|cifs|smbfs|ocfs2|gfs2|none|lustre)
 </i>&gt;<i>  			false;;
</i>&gt;<i>  		    *)
</i>&gt;<i>  			true;;
</i>&gt;<i> @@ -461,8 +461,11 @@
</i>&gt;<i>  		if [ -z "$FSTYPE" -o "$FSTYPE" = none ]; then
</i>&gt;<i>  			: No FSTYPE specified, rely on the system has the right file-system \
support already  </i>&gt;<i>  		else
</i>&gt;<i> -			# Insert Filesystem module
</i>&gt;<i> -			$MODPROBE $FSTYPE &gt;/dev/null 
</i>&gt;<i> +			grep -e "$FSTYPE"'$' /proc/filesystems &gt;/dev/null
</i>&gt;<i> +			if [ $? -ne 0 ] ; then
</i>&gt;<i> +				# Insert Filesystem module
</i>&gt;<i> +				$MODPROBE $FSTYPE &gt;/dev/null 
</i>&gt;<i> +			fi
</i>&gt;<i>  			grep -e "$FSTYPE"'$' /proc/filesystems &gt;/dev/null
</i>&gt;<i>  			if [ $? -ne 0 ] ; then
</i>&gt;<i>  				ocf_log err "Couldn't find filesystem $FSTYPE in /proc/filesystems"
</i>&gt;<i> @@ -972,6 +975,8 @@
</i>&gt;<i>  	;;
</i>&gt;<i>  //[!/]*/*)	# An SMB filesystem specification...
</i>&gt;<i>  	;;
</i>&gt;<i> +none)
</i>&gt;<i> +	;;
</i>&gt;<i>  /dev/null)	# Special case for BSC
</i>&gt;<i>  	blockdevice=yes
</i>&gt;<i>  	;;</i></pre>
  </body>
</html>



_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic