ltspfs shows wrong partition size when plug-in usb drive into thin client

Bug #1021579 reported by demon on 2012-07-06
42
This bug affects 9 people
Affects Status Importance Assigned to Milestone
LTSP5
High
Unassigned
ltspfs (Ubuntu)
Undecided
Unassigned

Bug Description

Ubuntu 12.04, ltspfs 1.1-2
When I plug-in usb drive with partition (vfat or ntfs) into thin client, it shows me wrong partition size. For example: I mount usb drive with vfat 4Gb, but df -h on server shows me:
ltspfs 967K 432K 536K 45% /media/user/Ubuntu
Where 967K is partition size.
In thin client cat /var/run/ltspfs_fstab
/dev/sda1 /var/run/drives/Ubuntu vfat rw,defaults,uft8 0 0
But mount didn't show this mount point on thin client, and /var/run/drives/Ubuntu folder is empty.

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in ltspfs (Ubuntu):
status: New → Confirmed
Gelu N. (gelu) wrote :

Yes, the bug exists as mentioned here: https://bugs.launchpad.net/ltsp/+bug/996533/comments/1 .

If you try to copy a file in nautilus, you are warned that "There is not enough space on the destination". But if "Copy Anyway" button is pressed, copying goes well without any problems.

Nahmias Lorenzo (lorenzo-im) wrote :

I have the same problem but it's critical for me as I use LTSP primarily to connect my thin clients to a Windows Terminal Server with rdesktop. Since LTSPFS reports no free space on USB drives, users are unable to save any data on such devices ("copy anyway" is not available in this configuration).

Nahmias Lorenzo (lorenzo-im) wrote :

My temporary solution is to downgrade the ltspfs package from 1.1-2 (precise) to 0.9-0ubuntu1 (oneiric) either on the server and the chroot. Everything works fine now.

.cobnet (mattias-campe) wrote :

Any progress on this bug?

datube (datube) wrote :

Hi,

I've downloaded the sources for the package "ltspfs", applied the following patch, compiled it, replaced "/usr/bin/ltspfs" manually and then it works as expected

Patch:
{{{
--- ltspfs-1.1/src/ltspfs.c
+++ ltspfs-1.1/src/ltspfs.c
@@ -907,14 +907,14 @@
     if (ret)
         return parse_return(&in);

- xdr_int(&in, &stbuf->f_type); /* type of fs */
- xdr_int(&in, &stbuf->f_bsize); /* optimal transfer block sz */
+ xdr_int(&in, &f_type); /* type of fs */
+ xdr_int(&in, &f_bsize); /* optimal transfer block sz */
     xdr_u_longlong_t(&in, &stbuf->f_blocks); /* total data blocks in fs */
     xdr_u_longlong_t(&in, &stbuf->f_bfree); /* free blks in fs */
     xdr_u_longlong_t(&in, &stbuf->f_bavail); /* free blks avail to non-su */
     xdr_u_longlong_t(&in, &stbuf->f_files); /* total file nodes in fs */
     xdr_u_longlong_t(&in, &stbuf->f_ffree); /* free file nodes in fs */
- xdr_int(&in, &stbuf->f_namelen);
+ xdr_int(&in, &f_namelen);

     return OK;
 }

}}}

Hope this helps, would be very great if it would be fixed...

datube (datube) wrote :

Hi,

I need to complete my solution. The above patch is for the server-side and the following fixes the one for the client (chroot):

{{{
--- ltspfs-1.1/src/ltspfsd_functions.c
+++ ltspfs-1.1/src/ltspfsd_functions.c
@@ -895,8 +895,8 @@
     xdr_int(&out, &i); /* dummy length */
     i = LTSP_STATUS_OK; /* OK status */
     xdr_int(&out, &i);
- xdr_int(&out, &f_type); /* type of fs */
- xdr_int(&out, &f_bsize); /* optimal transfer block sz */
+ xdr_int(&out, &stbuf.f_type); /* type of fs */
+ xdr_int(&out, &stbuf.f_bsize); /* optimal transfer block sz */
     xdr_u_longlong_t(&out, &stbuf.f_blocks); /* total data blocks in fs */
     xdr_u_longlong_t(&out, &stbuf.f_bfree); /* free blks in fs */
     xdr_u_longlong_t(&out, &stbuf.f_bavail); /* free blks avail to non-su */
}}}

Still hopes this helps

datube (datube) wrote :

Hi again... I made a mistake (guess I need more coffee or something) , first patch is reversed... It should read:

{{{
--- ltspfs-1.1/src/ltspfs.c
+++ ltspfs-1.1/src/ltspfs.c
@@ -907,14 +907,14 @@
     if (ret)
         return parse_return(&in);

- xdr_int(&in, &f_type); /* type of fs */
- xdr_int(&in, &f_bsize); /* optimal transfer block sz */
+ xdr_int(&in, &stbuf->f_type); /* type of fs */
+ xdr_int(&in, &stbuf->f_bsize); /* optimal transfer block sz */
     xdr_u_longlong_t(&in, &stbuf->f_blocks); /* total data blocks in fs */
     xdr_u_longlong_t(&in, &stbuf->f_bfree); /* free blks in fs */
     xdr_u_longlong_t(&in, &stbuf->f_bavail); /* free blks avail to non-su */
     xdr_u_longlong_t(&in, &stbuf->f_files); /* total file nodes in fs */
     xdr_u_longlong_t(&in, &stbuf->f_ffree); /* free file nodes in fs */
- xdr_int(&in, &f_namelen);
+ xdr_int(&in, &stbuf->f_namelen);

     return OK;
 }

}}}

Michael Blinn (mblinn-gmail) wrote :

Bug confirmed in ltspfs 1.3-1 (Ubuntu Trusty Tahr)

Confirmed. If above patch works, please commit.

Michael Blinn (mblinn-gmail) wrote :

Hoping to get this bug fix committed to 14.04

On 2014-04-15, datube wrote:
> Hi again... I made a mistake (guess I need more coffee or something) ,
> first patch is reversed... It should read:

Tested your patches, and with slight modifications, committed upstream:

  https://bazaar.launchpad.net/~ltsp-upstream/ltsp/ltspfs-trunk/revision/170

Thanks for the fix!

live well,
  vagrant

Vagrant Cascadian (vagrantc) wrote :
Changed in ltsp:
importance: Undecided → High
status: New → Fix Committed
Vagrant Cascadian (vagrantc) wrote :

On 2014-08-13, Vagrant Cascadian wrote:
> Tested your patches, and with slight modifications, committed upstream:
>
> https://bazaar.launchpad.net/~ltsp-upstream/ltsp/ltspfs-trunk/revision/170

These patches, while they appear to work, generate some build warnings:

Making all in src
make[3]: Entering directory '/«PKGBUILDDIR»/src'
gcc -DHAVE_CONFIG_H -I. -I.. -D_FORTIFY_SOURCE=2 -Wall -W
-D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=22 -D_REENTRANT -g -O2
-fstack-protector-strong -
Wformat -Werror=format-security -c -o ltspfs-ltspfs.o `test -f
'ltspfs.c' || echo './'`ltspfs.c
ltspfs.c: In function 'ltspfs_statfs':
ltspfs.c:891:9: warning: unused variable 'f_namelen' [-Wunused-variable]
     int f_namelen = (int)stbuf->f_namelen;
         ^
ltspfs.c:890:9: warning: unused variable 'f_bsize' [-Wunused-variable]
     int f_bsize = (int)stbuf->f_bsize;
         ^
ltspfs.c:889:9: warning: unused variable 'f_type' [-Wunused-variable]
     int f_type = (int)stbuf->f_type;
         ^
...

gcc -DHAVE_CONFIG_H -I. -I.. -D_FORTIFY_SOURCE=2 -Wall -W
-D_FILE_OFFSET_BITS=64 -DAUTOMOUNT -D_REENTRANT -g -O2
-fstack-protector-strong -Wformat -Werror=format-security -c -o
ltspfsd-ltspfsd_functions.o `test -f 'ltspfsd_functions.c' || echo './'`ltspfsd_functions.c
ltspfsd_functions.c: In function 'ltspfs_statfs':
ltspfsd_functions.c:906:18: warning: 'f_type' may be used uninitialized
in this function [-Wmaybe-uninitialized]
     stbuf.f_type = (__SWORD_TYPE) f_type;
                  ^
ltspfsd_functions.c:907:19: warning: 'f_bsize' may be used uninitialized
in this function [-Wmaybe-uninitialized]
     stbuf.f_bsize = (__SWORD_TYPE) f_bsize;
                   ^

These patches seem to need little more touch-up...

They also seem to partially revert changes introduced in:

  https://bazaar.launchpad.net/~ltsp-upstream/ltsp/ltspfs-trunk/revision/153

Maybe the size reporting issues go back that far...

live well,
  vagrant

Changed in ltsp:
status: Fix Committed → In Progress
Vagrant Cascadian (vagrantc) wrote :

Fixed in ltspfs 1.4

Changed in ltsp:
status: Fix Committed → Fix Released
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ltspfs - 1.4-1

---------------
ltspfs (1.4-1) unstable; urgency=medium

  * New upstream version:
    - Fix filesystem size calculations. Thanks to datube for the initial
      patch! (LP: #1021579).
    - Mount ltspfs filesystem directly to /media/username/mountpoint
      (Closes: #758090).
    - Add support for starting ltspfsd from systemd service file when
      systemd is running (Closes: #758093).
    - ltspfsd: Don't add duplicate entries to ltspfs_fstab.

 -- Vagrant Cascadian <email address hidden> Mon, 18 Aug 2014 09:48:57 -0700

Changed in ltspfs (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers